Add failing spec for uncaught main process errors
This commit is contained in:
parent
a4e25a8917
commit
24fb560a9d
2 changed files with 33 additions and 12 deletions
|
@ -273,3 +273,18 @@ ipcMain.on('try-emit-web-contents-event', (event, id, eventName) => {
|
|||
listenerCountAfter
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.on('handle-uncaught-exception', (event, message) => {
|
||||
const listeners = process.listeners('uncaughtException')
|
||||
process.removeAllListeners('uncaughtException')
|
||||
process.on('uncaughtException', (error) => {
|
||||
process.removeAllListeners('uncaughtException')
|
||||
listeners.forEach((listener) => {
|
||||
process.on('uncaughtException', listener)
|
||||
})
|
||||
event.returnValue = error.message
|
||||
})
|
||||
fs.readFile(__filename, () => {
|
||||
throw new Error(message)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue