mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Add global exception handlers
This commit is contained in:
parent
65c9ca62de
commit
efb0044419
1 changed files with 15 additions and 0 deletions
|
|
@ -11,6 +11,21 @@ export async function main(args) {
|
|||
const proxy = createSafeChainProxy();
|
||||
await proxy.startServer();
|
||||
|
||||
// Global error handlers to log unhandled errors
|
||||
process.on("uncaughtException", (error) => {
|
||||
ui.writeError(`Safe-chain: Uncaught exception: ${error.message}`);
|
||||
ui.writeVerbose(`Stack trace: ${error.stack}`);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
process.on("unhandledRejection", (reason) => {
|
||||
ui.writeError(`Safe-chain: Unhandled promise rejection: ${reason}`);
|
||||
if (reason instanceof Error) {
|
||||
ui.writeVerbose(`Stack trace: ${reason.stack}`);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
try {
|
||||
// This parses all the --safe-chain arguments and removes them from the args array
|
||||
args = initializeCliArguments(args);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue