Skip to content

Commit

Permalink
fix(scan): raise an exception if scan enters into queued status
Browse files Browse the repository at this point in the history
closes #66
  • Loading branch information
derevnjuk committed May 16, 2022
1 parent 80b7785 commit 3a9f96f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/scan/src/Scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class Scan {
return this.state;
}

// eslint-disable-next-line complexity
public async expect(
expectation: Severity | ((scan: Scan) => unknown)
): Promise<void> {
Expand All @@ -94,6 +95,13 @@ export class Scan {
clearTimeout(timer);
}

if (status === ScanStatus.QUEUED) {
throw new Error(
`The maximum amount of concurrent scans has been reached for the organization.
Please upgrade your subscription or contact your system administrator.`
);
}

if (this.done && status !== ScanStatus.DONE) {
throw new Error(`Scan failed with status ${status}.`);
}
Expand Down

0 comments on commit 3a9f96f

Please sign in to comment.