Skip to content

Prevent Node process from collapsing #40

@blairg

Description

@blairg

The Node process will exit ungracefully if a promise throws an unhandled exception. Solution similar to below:-

process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at:', p, 'reason:', reason);
// application specific logging, throwing an error, or other logic here
});

somePromise.then((res) => {
return reportToUser(JSON.pasre(res)); // note the typo (pasre)
}); // no .catch or .then

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions