unhandledRejection

node v14.20.1
version: 1.0.2
endpointsharetweet
process.on('unhandledRejection', (reason, promise) => { console.log(`Unhandled Rejection: ${reason}`); }); async function main() { const p1 = Promise.reject("Rejected!"); //await new Promise(r => setTimeout(r, 0)); await Promise.resolve(); await p1; } main().catch(e => console.warn(`caught on main: ${e}`));
Loading…

no comments

    sign in to comment