# errorgap for Bun

See [index.md](./index.md) for API details and the placeholder values (`ERRORGAP_API_KEY`, `ERRORGAP_ENDPOINT`, `ERRORGAP_PROJECT_SLUG`).

SDK source: `github.com/errorgaphq/errorgap-bun` · current version: `0.2.0`. Requires Bun 1.0+.

## Install

```sh
bun add @errorgap/bun
```

The package ships as TypeScript source — Bun loads it directly, no build step.

## Configure

In your entry file (e.g. `index.ts`):

```ts
import { Errorgap } from "@errorgap/bun";

Errorgap.init({
  endpoint:    process.env.ERRORGAP_ENDPOINT,
  projectSlug: process.env.ERRORGAP_PROJECT_SLUG,
  apiKey:      process.env.ERRORGAP_API_KEY,
  environment: process.env.NODE_ENV ?? "production",
});
```

`init` hooks `process.uncaughtException` and `process.unhandledRejection`.

## Trigger a test error

```ts
throw new Error("Errorgap test error");
```

## Verify

Run the verification curl from [index.md](./index.md), then throw the test error and confirm the onboarding screen advances.
