electron/spec/fixtures/api/unhandled-rejection-handled.js

14 lines
288 B
JavaScript
Raw Normal View History

const { app } = require('electron');
const handleUnhandledRejection = (reason) => {
console.error(`Unhandled Rejection: ${reason.stack}`);
app.quit();
};
const main = async () => {
process.on('unhandledRejection', handleUnhandledRejection);
throw new Error('oops');
};
main();