Skip to content

Commit 0376b25

Browse files
d-gubertclaude
andcommitted
refactor(apps): converge error-handlers notification shape in deno-runtime
Emit the same JSON-RPC notification shape node-runtime uses for uncaught errors: method is the origin ('uncaughtException' / 'unhandledRejection') and params is [error.stack || error], instead of the richer { type, message, filename, ... } / { type, reason, timestamp } objects. The addEventListener registration mechanism stays as the remaining genuine platform difference. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d924409 commit 0376b25

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

packages/apps/deno-runtime/error-handlers.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,22 @@ import * as Messenger from './lib/messenger';
33
export function unhandledRejectionListener(event: PromiseRejectionEvent) {
44
event.preventDefault();
55

6-
const { type, reason } = event;
6+
const error = event.reason;
77

88
Messenger.sendNotification({
99
method: 'unhandledRejection',
10-
params: [
11-
{
12-
type,
13-
reason: reason instanceof Error ? reason.message : reason,
14-
timestamp: new Date(),
15-
},
16-
],
10+
params: [error?.stack || error],
1711
});
1812
}
1913

2014
export function unhandledExceptionListener(event: ErrorEvent) {
2115
event.preventDefault();
2216

23-
const { type, message, filename, lineno, colno } = event;
17+
const error = event.error;
18+
2419
Messenger.sendNotification({
2520
method: 'uncaughtException',
26-
params: [{ type, message, filename, lineno, colno }],
21+
params: [error?.stack || error],
2722
});
2823
}
2924

0 commit comments

Comments
 (0)