Skip to content

Commit 079a1e1

Browse files
committed
fix(ses): fix 2943 error trapping issues
1 parent d3972dd commit 079a1e1

File tree

4 files changed

+3
-1
lines changed

4 files changed

+3
-1
lines changed

packages/ses/error-codes/SES_UNCAUGHT_EXCEPTION.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This behavior is configured by calling `lockdown` with the [errorTrapping][] opt
66

77
Otherwise, when thrown exceptions have no `catch` handler, the SES shim will print `SES_UNCAUGHT_EXCEPTION: exception...` to the error console. In that case, `exception...` is the thrown exception, augmented with causal error information when possible.
88

9+
On some platforms, the default errorTrapping behavior reports the error, but the platform's user trapping mechanism reports only an event with no error. (See https://github.com/endojs/endo/issues/2941 test1.) In that case, non-default `errorTrapping` reports the event about the error, rather than the error itself. This often has much less relevant information.
10+
911
For most programs, the error console is intended for human consumption, and so the `SES_UNCAUGHT_EXCEPTION:` output can be useful in giving a clue as to the source of a failure.
1012

1113
[errorTrapping]: ../docs/lockdown.md#errortrapping-options

packages/ses/src/error/tame-console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export const tameConsole = (
156156
globalWindow.addEventListener('error', event => {
157157
event.preventDefault();
158158
// See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_UNCAUGHT_EXCEPTION.md
159-
ourConsole.error('SES_UNCAUGHT_EXCEPTION:', event.error);
159+
ourConsole.error('SES_UNCAUGHT_EXCEPTION:', event.error || event);
160160
// 'platform' and 'report' just log the reason.
161161
if (errorTrapping === 'exit' || errorTrapping === 'abort') {
162162
globalWindow.location.href = `about:blank`;
77.6 KB
Loading
82.1 KB
Loading

0 commit comments

Comments
 (0)