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}`));