Skip to content

Commit 4ed78b8

Browse files
HazATandreiborza
authored andcommitted
[v8] Bun Global Unhandled Handlers (#11960)
Add support for global onUnhandled Error/Promise for Bun. ```javascript import * as Sentry from "@sentry/bun"; Sentry.init({ dsn: "DSN", }); console.log("Hello via Bun!"); throw new Error('Unhandled Bun Sentry Error!'); ``` <img width="1063" alt="image" src="https://github.com/getsentry/sentry-javascript/assets/363802/fd90969f-82a4-4300-a67e-1ebb5cf540fa"> ref: oven-sh/bun#5091
1 parent c0358f5 commit 4ed78b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/bun/src/sdk.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
modulesIntegration,
1313
nativeNodeFetchIntegration,
1414
nodeContextIntegration,
15+
onUncaughtExceptionIntegration,
16+
onUnhandledRejectionIntegration,
1517
} from '@sentry/node';
1618
import type { Integration, Options } from '@sentry/types';
1719

@@ -33,9 +35,9 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
3335
consoleIntegration(),
3436
httpIntegration(),
3537
nativeNodeFetchIntegration(),
36-
// Global Handlers # TODO (waiting for https://github.com/oven-sh/bun/issues/5091)
37-
// new NodeIntegrations.OnUncaughtException(),
38-
// new NodeIntegrations.OnUnhandledRejection(),
38+
// Global Handlers
39+
onUncaughtExceptionIntegration(),
40+
onUnhandledRejectionIntegration(),
3941
// Event Info
4042
contextLinesIntegration(),
4143
nodeContextIntegration(),

0 commit comments

Comments
 (0)