Skip to content

Commit

Permalink
[v8] Bun Global Unhandled Handlers (#11960)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
HazAT authored and andreiborza committed May 16, 2024
1 parent c0358f5 commit 4ed78b8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/bun/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
modulesIntegration,
nativeNodeFetchIntegration,
nodeContextIntegration,
onUncaughtExceptionIntegration,
onUnhandledRejectionIntegration,
} from '@sentry/node';
import type { Integration, Options } from '@sentry/types';

Expand All @@ -33,9 +35,9 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
consoleIntegration(),
httpIntegration(),
nativeNodeFetchIntegration(),
// Global Handlers # TODO (waiting for https://github.com/oven-sh/bun/issues/5091)
// new NodeIntegrations.OnUncaughtException(),
// new NodeIntegrations.OnUnhandledRejection(),
// Global Handlers
onUncaughtExceptionIntegration(),
onUnhandledRejectionIntegration(),
// Event Info
contextLinesIntegration(),
nodeContextIntegration(),
Expand Down

0 comments on commit 4ed78b8

Please sign in to comment.