mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
fix: don't double-log unhandled rejections (#37464)
This commit is contained in:
13
spec/fixtures/api/unhandled-rejection-handled.js
vendored
Normal file
13
spec/fixtures/api/unhandled-rejection-handled.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
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();
|
||||
5
spec/fixtures/api/unhandled-rejection.js
vendored
Normal file
5
spec/fixtures/api/unhandled-rejection.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
const main = async () => {
|
||||
throw new Error('oops');
|
||||
};
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user