Skip to content

Commit 75e5501

Browse files
authored
[v7] Bun Global Unhandled Handlers (#11959)
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 02bc198 commit 75e5501

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
@@ -13,6 +13,8 @@ import {
1313
modulesIntegration,
1414
nativeNodeFetchintegration,
1515
nodeContextIntegration,
16+
onUncaughtExceptionIntegration,
17+
onUnhandledRejectionIntegration,
1618
} from '@sentry/node';
1719
import type { Integration, Options } from '@sentry/types';
1820

@@ -32,9 +34,9 @@ export const defaultIntegrations = [
3234
consoleIntegration(),
3335
httpIntegration(),
3436
nativeNodeFetchintegration(),
35-
// Global Handlers # TODO (waiting for https://github.com/oven-sh/bun/issues/5091)
36-
// new NodeIntegrations.OnUncaughtException(),
37-
// new NodeIntegrations.OnUnhandledRejection(),
37+
// Global Handlers
38+
onUncaughtExceptionIntegration(),
39+
onUnhandledRejectionIntegration(),
3840
// Event Info
3941
contextLinesIntegration(),
4042
// new NodeIntegrations.LocalVariables(), # does't work with Bun

0 commit comments

Comments
 (0)