mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-10 18:23:21 +08:00
[client-app] Fix unhandled rejection handling (fix ipc parse error)
Summary: Previously, we were listening for unhanlded rejections on both the `window` and the `process`. However, the window handler didn't receive an error as a parameter, but rather a window event. When trying to report this event and sending it over IPC we would get an ipc parse error. This commit makes it so we correctly report the error instead of the window event. Test Plan: manual Reviewers: mark, halla Reviewed By: halla Differential Revision: https://phab.nylas.com/D4412
This commit is contained in:
parent
d30559aa6e
commit
b6771ea745
1 changed files with 9 additions and 2 deletions
|
@ -277,7 +277,6 @@ export default class NylasEnvConstructor {
|
|||
originalError.stack = convertStackTrace(originalError.stack, sourceMapCache);
|
||||
return this.reportError(originalError, {url, line: newLine, column: newColumn});
|
||||
};
|
||||
window.addEventListener("unhandledrejection", e => this.reportError(e));
|
||||
|
||||
process.on('uncaughtException', e => this.reportError(e));
|
||||
|
||||
|
@ -293,7 +292,15 @@ export default class NylasEnvConstructor {
|
|||
if (this.inDevMode()) {
|
||||
error.stack = convertStackTrace(error.stack, sourceMapCache);
|
||||
}
|
||||
return this.reportError(error);
|
||||
this.reportError(error);
|
||||
});
|
||||
|
||||
window.addEventListener('unhandledrejection', e => {
|
||||
const error = e.detail.reason
|
||||
if (this.inDevMode()) {
|
||||
error.stack = convertStackTrace(error.stack, sourceMapCache);
|
||||
}
|
||||
this.reportError(error)
|
||||
});
|
||||
|
||||
if (this.inSpecMode() || (this.inDevMode() && !this.inBenchmarkMode())) {
|
||||
|
|
Loading…
Reference in a new issue