You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
412 B
10 lines
412 B
process.on('unhandledRejection', reason => {
|
|
// If the reason is already an Error object, throw it directly to preserve the stack trace.
|
|
if (reason instanceof Error) {
|
|
throw reason;
|
|
} else {
|
|
// If the reason is not an Error (e.g., a string, number, or other primitive),
|
|
// create a new Error object with the reason as its message.
|
|
throw new Error(`Unhandled rejection: ${reason}`);
|
|
}
|
|
});
|
|
|