Lightweight browser error tracking SDK for Centry.
npm install github:las6/centry-clientCall init() once in your client entry file (before React mounts, or at the top of your main module). Unhandled errors and promise rejections are captured automatically.
import { init } from 'centry-client'
init({ project: 'my-project' })You can also set an optional environment and release:
init({
project: 'my-project',
environment: 'production', // optional — defaults to undefined
release: '1.2.0', // optional — defaults to undefined
})If you prefer a React component, CentryProvider wraps init() and installs global handlers on mount:
import { CentryProvider } from 'centry-client'
<CentryProvider project="my-project" environment="production">
<App />
</CentryProvider>CentryProvider accepts the same config as init() (all props except project are optional).
For errors caught in try/catch or error boundaries:
import { captureException } from 'centry-client'
captureException(error)If you need a client instance directly:
import { CentryClient } from 'centry-client'
const client = new CentryClient({ project: 'my-project' })
client.captureException(error)| Option | Type | Default | Description |
|---|---|---|---|
project (required) |
string |
— | Project ID from your Centry dashboard |
environment |
string |
undefined |
e.g. production, staging |
release |
string |
undefined |
App version or commit hash |
enabled |
boolean |
true |
Set to false to disable reporting |
allowUrls |
RegExp[] |
— | Only mark frames matching these URLs as in-app |
maxEventsPerMinute |
number |
10 |
Hard cap on errors sent per 60-second window |
dedupWindowMs |
number |
10000 |
Suppress duplicate errors for this duration (ms) |