@digivogt/exceptions-browser
v1.0.0
Published
Digivogt exception tracker for browsers — zero-dependency error reporting
Maintainers
Readme
@digivogt/exceptions-browser
Zero-dependency exception tracker for browser applications. Reports errors to the Digivogt exception tracking API.
Install
npm install @digivogt/exceptions-browserUsage
import { init, captureException } from '@digivogt/exceptions-browser';
init({
vogteiId: 'your-vogtei-id',
source: 'webapp', // optional, identifies the reporting app
environment: 'production', // optional
apiUrl: 'https://api.digivogt.com', // optional, this is the default
});
// Manual capture
try {
riskyOperation();
} catch (error) {
captureException(error, { component: 'Checkout' });
}After calling init(), uncaught errors and unhandled promise rejections are automatically captured via window.addEventListener('error') and window.addEventListener('unhandledrejection').
API
init(options)
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| vogteiId | string | yes | Your Vogtei ID |
| source | string | no | Name of the reporting application |
| environment | string | no | e.g. production, staging |
| apiUrl | string | no | API base URL (default: https://api.digivogt.com) |
captureException(error, context?)
| Parameter | Type | Description |
|-----------|------|-------------|
| error | Error | The error to report |
| context | object | Optional key-value metadata attached to the report |
Browser-specific context (navigator.userAgent, location.href) is automatically included with every report.
Requirements
- No runtime dependencies
- Uses
fetchwithkeepalive: trueto ensure delivery even during page unload
How it works
Exceptions are sent to POST /vogteien/:vogteiId/exceptions (a public endpoint, no authentication required). The API deduplicates by fingerprint (SHA-256 of error type + first stack frame) and tracks occurrence count, first/last seen timestamps, and the latest stack trace and context.
License
MIT
