Handle errors when retrieving variant analyses in the monitor
This will add error handling to the retrieval of variant analyses in the monitor by catching the error. It will show a warning to the user and log it. Then, it will simply sleep for 5 seconds and try again. I'm not sure if we want to show all of these errors to the user since this can result in many warnings popping up if many variant analyses are being monitored, but this is probably that the user should be made aware of.
This commit is contained in:
@@ -13,9 +13,12 @@ import {
|
||||
VariantAnalysis,
|
||||
VariantAnalysisScannedRepository,
|
||||
} from "./shared/variant-analysis";
|
||||
import { VariantAnalysis as ApiVariantAnalysis } from "./gh-api/variant-analysis";
|
||||
import { processUpdatedVariantAnalysis } from "./variant-analysis-processor";
|
||||
import { DisposableObject } from "../pure/disposable-object";
|
||||
import { sleep } from "../pure/time";
|
||||
import { getErrorMessage } from "../pure/helpers-pure";
|
||||
import { showAndLogWarningMessage } from "../helpers";
|
||||
|
||||
export class VariantAnalysisMonitor extends DisposableObject {
|
||||
// With a sleep of 5 seconds, the maximum number of attempts takes
|
||||
@@ -60,11 +63,19 @@ export class VariantAnalysisMonitor extends DisposableObject {
|
||||
return;
|
||||
}
|
||||
|
||||
const variantAnalysisSummary = await getVariantAnalysis(
|
||||
credentials,
|
||||
variantAnalysis.controllerRepo.id,
|
||||
variantAnalysis.id,
|
||||
);
|
||||
let variantAnalysisSummary: ApiVariantAnalysis;
|
||||
try {
|
||||
variantAnalysisSummary = await getVariantAnalysis(
|
||||
credentials,
|
||||
variantAnalysis.controllerRepo.id,
|
||||
variantAnalysis.id,
|
||||
);
|
||||
} catch (e) {
|
||||
void showAndLogWarningMessage(
|
||||
`Error while monitoring variant analysis: ${getErrorMessage(e)}`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
variantAnalysis = processUpdatedVariantAnalysis(
|
||||
variantAnalysis,
|
||||
|
||||
Reference in New Issue
Block a user