Skip to main content

Error Capture

Syntropy automatically captures unhandled errors and provides APIs for manual error reporting.

Automatic Capture

By default, SDKs automatically capture:

PlatformCaptured Events
Browserwindow.onerror, unhandledrejection
Node.jsuncaughtException, unhandledRejection
React NativeErrorUtils, Promise rejections

Disabling Auto-Capture

Syntropy.init({
projectId: 'your-project-id',
autoCapture: false, // Disable automatic capture
});

Manual Capture

Basic Usage

try {
riskyOperation();
} catch (error) {
Syntropy.captureError(error);
}

With Context

Syntropy.captureError(error, {
// Tags for filtering
tags: {
component: 'checkout',
priority: 'high',
},

// Extra data for debugging
extra: {
orderId: '12345',
cartItems: items,
},
});

From String

Syntropy.captureError('Something went wrong');

Error Context

Tags

Tags are indexed and searchable. Use for:

  • Component/feature identification
  • Priority levels
  • Custom categorization
Syntropy.captureError(error, {
tags: {
component: 'payment',
priority: 'critical',
handler: 'stripe-webhook',
},
});

Extra Data

Extra data is attached to the error but not indexed. Use for:

  • Debugging information
  • Variable values
  • State snapshots
Syntropy.captureError(error, {
extra: {
userId: user.id,
requestBody: req.body,
attemptNumber: retries,
},
});

Global Context

Set context that applies to all errors:

// Set global tags
Syntropy.setTag('version', '2.0.0');
Syntropy.setTag('tenant', 'acme');

// Set global extra data
Syntropy.setExtra('hostname', os.hostname());

// All future errors include this context

Filtering Errors

Use beforeSend to filter or modify errors:

Syntropy.init({
projectId: 'your-project-id',
beforeSend: (event) => {
// Drop specific errors
if (event.payload.message?.includes('ResizeObserver')) {
return null;
}

// Scrub sensitive data
if (event.payload.extra?.password) {
delete event.payload.extra.password;
}

return event;
},
});

Error Grouping

Syntropy automatically groups similar errors into Issues based on:

  1. Error message (normalized)
  2. Stack trace (top frames)

This prevents duplicate noise in your dashboard.

Custom Fingerprinting

Override the default grouping:

Syntropy.captureError(error, {
fingerprint: ['custom-group-key'],
});

Severity

captureError(...) sends errors with error severity by default.

If you need custom severity values, use beforeSend to modify outgoing events:

Syntropy.init({
projectId: 'your-project-id',
beforeSend: (event) => {
if (event.type === 'error') {
event.payload = {
...event.payload,
severity: 'warning',
};
}
return event;
},
});