Add failing spec for uncaught main process errors

This commit is contained in:
Kevin Sawicki 2017-01-25 08:55:38 -08:00
parent a4e25a8917
commit 24fb560a9d
2 changed files with 33 additions and 12 deletions

View file

@ -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)
})
})