| name | 1k-sentry |
| description | Configure OneKey Sentry and filter events across desktop, mobile, web, and extension. |
Sentry Integration
OneKey uses Sentry for error tracking across all platforms.
Architecture Overview
apps/
โโโ desktop/app/sentry.ts # Desktop main process
โโโ ext/ # Extension (uses shared)
โโโ mobile/ # Mobile (uses shared)
โโโ web/ # Web (uses shared)
packages/shared/src/modules3rdParty/sentry/
โโโ index.ts # Web/Extension entry
โโโ index.native.ts # React Native entry
โโโ index.desktop.ts # Desktop renderer entry
โโโ basicOptions.ts # Shared config & error filtering
โโโ instance.ts # Sentry client instance
Platform Detection
import platformEnv from '@onekeyhq/shared/src/platformEnv';
platformEnv.isDesktop
platformEnv.isNative
platformEnv.isWeb
platformEnv.isExtension
platformEnv.isWebEmbed
Common Tasks
Filter/Ignore Errors
See: references/rules/ignoring-errors.md
Key file: packages/shared/src/modules3rdParty/sentry/basicOptions.ts
Add Custom Context
import * as Sentry from '@sentry/react-native';
Sentry.addBreadcrumb({
category: 'action',
message: 'User clicked button',
level: 'info',
});
Sentry.setUser({ id: 'user-id' });
Sentry.setTag('feature', 'swap');
Sentry.captureException(error, {
extra: { additionalData: 'value' },
});
Key Files
| Purpose | File |
|---|
| Error filtering | packages/shared/src/modules3rdParty/sentry/basicOptions.ts |
| Desktop main | apps/desktop/app/sentry.ts |
| Desktop renderer | packages/shared/src/modules3rdParty/sentry/index.desktop.ts |
| Web/Extension | packages/shared/src/modules3rdParty/sentry/index.ts |
| Native | packages/shared/src/modules3rdParty/sentry/index.native.ts |
Error Filtering Quick Reference
const FILTERED_ERROR_TYPES = new Set(['AxiosError', 'HTTPClientError']);
const FILTER_ERROR_VALUES = ['AbortError: AbortError'];
if (error.value?.includes('PATTERN')) return true;
Related Skills
/1k-coding-patterns - Error handling best practices