-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure errors from most imports are handled
- Loading branch information
Jahed Ahmed
committed
Nov 25, 2021
1 parent
d0fb7cc
commit a8835ab
Showing
4 changed files
with
20 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const EXIT_CODES = { | ||
VULNS_FOUND: 1, | ||
ERROR: 2, | ||
NO_SUPPORTED_PROJECTS_DETECTED: 3, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { callHandlingUnexpectedErrors } from '../lib/unexpected-error'; | ||
import { EXIT_CODES } from './exit-codes'; | ||
|
||
/** | ||
* By using a dynamic import, we can add error handlers before evaluating any | ||
* further modules. This way, if a module has errors, it'll be caught and | ||
* handled as we expect. | ||
*/ | ||
callHandlingUnexpectedErrors(async () => { | ||
const { main } = await import('./main'); | ||
await main(); | ||
}, EXIT_CODES.ERROR); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters