@sophonz/instrumentation-browser-exception
v0.0.9
Published
Readme
@sophonz/instrumentation-browser-exception
Captures unhandled JavaScript exceptions and errors in the browser, creating traces for error events and exceptions.
Part of the Sophonz OpenTelemetry suite.
Install
bun add @sophonz/instrumentation-browser-exception
# or
pnpm add @sophonz/instrumentation-browser-exception
# or
npm install @sophonz/instrumentation-browser-exceptionUsage
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { SophonzErrorInstrumentation } from '@sophonz/instrumentation-browser-exception';
registerInstrumentations({
instrumentations: [new SophonzErrorInstrumentation()],
});The instrumentation auto-registers to capture uncaught exceptions when enabled.
API
| Export | Purpose |
|--------|---------|
| SophonzErrorInstrumentation | Main instrumentation class that extends InstrumentationBase and captures browser exceptions. |
| recordException | Function to manually record an exception as a span. |
TODO: Document exception filtering and error type configuration options.
Peer dependencies
@opentelemetry/api^1.9.1@opentelemetry/core^2.7.1@opentelemetry/instrumentation^0.217.0@opentelemetry/semantic-conventions^1.40.0
License
See LICENSE in this package.
Part of sophonz-js.
