@maximebonhomme/observerkit-js
v1.3.2
Published
Error tracking SDK for [ObserverKit](https://observerkit.com).
Readme
@maximebonhomme/observerkit-js
Error tracking SDK for ObserverKit.
Install
npm install @maximebonhomme/observerkit-jsSetup
import { ObserverKit } from "@maximebonhomme/observerkit-js"
ObserverKit.init({
apiKey: "ok_proj_...",
})Auto-capture of uncaught errors and unhandled promise rejections is enabled by default.
init options
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| apiKey | string | required | ObserverKit project API key |
| autoCapture | boolean | true | Automatically capture uncaught errors and unhandled promise rejections |
| endpoint | URL | https://ingest.observerkit.com | Ingest API base URL |
| environment | string | undefined | Environment name attached to error events (e.g. "production", "staging") |
Capture errors manually
import { ObserverKit } from "@maximebonhomme/observerkit-js"
try {
// ...
} catch (error) {
ObserverKit.captureException(error, {
metadata: { userId: "123" },
})
}captureException options
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| metadata | Record<string, unknown> | undefined | Additional metadata to attach to the error event |
