hodos360-error-tracker
v1.2.0
Published
Error tracking SDK for Hodos360 Team Management
Readme
@hodos360/error-tracker
Error tracking SDK for Hodos360 Team Management. Captures errors automatically in both browser and Node.js environments and sends them to the Hodos360 error ingestion endpoint.
Installation
npm install @hodos360/error-trackerOr with yarn:
yarn add @hodos360/error-trackerQuick Start
import { HodosErrorTracker } from '@hodos360/error-tracker';
const tracker = new HodosErrorTracker({
apiKey: 'your-api-key',
environment: 'production',
appVersion: '1.0.0',
debug: true, // Enable console logging (disable in production)
});
// Auto-capture unhandled errors and promise rejections
tracker.install();
// Identify the current user
tracker.setUser({ id: 'user-123', email: '[email protected]', name: 'Jane Doe' });
// Add custom tags
tracker.setTag('team', 'backend');
tracker.setTag('feature', 'auth');Manual Error Capture
try {
riskyOperation();
} catch (error) {
tracker.captureError(error as Error, { context: 'riskyOperation' });
}
// Capture a message without an Error object
tracker.captureMessage('Deployment started', 'info');Breadcrumbs
Breadcrumbs provide a trail of events leading up to an error:
tracker.addBreadcrumb({
message: 'User clicked checkout',
category: 'ui',
level: 'info',
data: { buttonId: 'checkout-btn' },
});Filtering Errors
Use beforeSend to modify or drop error payloads before they are sent:
const tracker = new HodosErrorTracker({
apiKey: 'your-api-key',
beforeSend: (payload) => {
// Drop errors from browser extensions
if (payload.error_stack?.includes('chrome-extension://')) {
return null;
}
return payload;
},
});Verify Connection
Check that the SDK can reach the ingestion endpoint:
const status = await tracker.verifyConnection();
console.log(status);
// { connected: true, latencyMs: 42, serverTime: '2026-03-09T...' }Configuration
| Option | Type | Default | Description |
|------------------|------------|----------------------------------|------------------------------------------|
| apiKey | string | required | Your project API key |
| endpoint | string | Hodos360 Supabase function URL | Custom ingestion endpoint |
| environment | string | 'production' | Environment name (e.g., staging, dev) |
| appVersion | string | undefined | Your application version |
| beforeSend | function | undefined | Hook to modify/filter payloads |
| maxBreadcrumbs | number | 20 | Max breadcrumbs kept in memory |
| debug | boolean | false | Log SDK activity to the console |
Cleanup
// Remove global handlers and flush queued errors
tracker.uninstall();Building from Source
cd sdk
npm install
npm run buildThis produces CJS, ESM, and type declaration files in the dist/ directory.
