:thinking_face: What if you could return an Error?
This commit is contained in:
parent
f469059e90
commit
1dea186a6e
1 changed files with 11 additions and 0 deletions
|
@ -45,6 +45,17 @@ electron.ipcRenderer.on('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', (ev
|
|||
event.sender.send(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, null, resolvedResult)
|
||||
})
|
||||
.catch((resolvedError) => {
|
||||
if (resolvedError instanceof Error) {
|
||||
// Errors get lost, because: JSON.stringify(new Error('Message')) === {}
|
||||
// Take the serializable properties and construct a generic object
|
||||
resolvedError = {
|
||||
message: resolvedError.message,
|
||||
stack: resolvedError.stack,
|
||||
name: resolvedError.name,
|
||||
__ELECTRON_SERIALIZED_ERROR__: true
|
||||
}
|
||||
}
|
||||
|
||||
event.sender.send(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, resolvedError)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue