Skip to content

Commit d830782

Browse files
committed
fix(cli): better handling of unhandledRejections
1 parent 45f0565 commit d830782

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/cli/handlers.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ export const setupSignalHandlers = (abortController: AbortController): void => {
4848
process.exit(ExitCodes.RUNTIME_ERROR);
4949
})
5050
.once('unhandledRejection', (reason) => {
51-
const wrappedError = new UnknownError(
52-
isError(reason) ? reason.message : String(reason),
53-
{ cause: reason },
54-
);
51+
const wrappedError: Error = isModestBenchError(reason)
52+
? reason
53+
: new UnknownError(isError(reason) ? reason.message : String(reason), {
54+
cause: reason,
55+
});
5556
console.error(`${wrappedError}`);
5657
process.exit(ExitCodes.RUNTIME_ERROR);
5758
});

0 commit comments

Comments
 (0)