in packages/health-client/src/scan-report-downloader.ts [36:56]
private validateScanStatusResponse(response: ResponseWithBodyType<ScanResultResponse>, scanId: string): boolean {
if (response.statusCode < 200 || response.statusCode > 299) {
this.logger.logError(`Get scan status for scanId ${scanId} failed with status code ${response.statusCode}`);
return false;
}
const errorResponse = response.body as ScanRunErrorResponse;
if (errorResponse.error) {
this.logger.logError(`Scan with id ${scanId} failed with error: ${JSON.stringify(errorResponse.error)}`);
return false;
}
const runResponse = response.body as ScanRunResultResponse;
if (!runResponse.reports || runResponse.reports.length === 0) {
this.logger.logError(`No reports found for scanId ${scanId}`);
return false;
}
return true;
}