
ignoring-sentry-errors
by OneKeyHQ
Secure, open source and community driven crypto wallet runs on all platforms and trusted by millions.
Use Cases
Smart Contract Development
Streamline smart contract creation and deployment.
Wallet Integration
Implement integration with crypto wallets.
Transaction Analysis
Analyze and track blockchain transactions.
SKILL.md
name: ignoring-sentry-errors description: Filters specific errors from Sentry reporting in this OneKey monorepo. Use when needing to ignore/suppress/filter Sentry errors, add error exclusions, or stop certain errors from being reported. Handles platform-specific filtering (desktop/mobile/web/extension).
Ignoring Sentry Errors
Follow this workflow to add new error filters to Sentry configuration.
Key File
All error filtering logic is centralized in:
packages/shared/src/modules3rdParty/sentry/basicOptions.ts
Workflow
1) Analyze the error
Identify the error pattern:
- Error type (e.g.,
Error,TypeError,AxiosError) - Error message/value (the text content)
- Platform (desktop/mobile/web/extension or all)
- Frequency (sporadic vs constant)
- Impact (blocks users or just noise)
2) Choose filtering strategy
Option A: Filter by error type (recommended for known error classes)
Add to FILTERED_ERROR_TYPES Set:
const FILTERED_ERROR_TYPES = new Set([
'AxiosError',
'HTTPClientError',
// Add your error type here
'YourErrorType',
]);
Option B: Filter by exact message match
Add to FILTER_ERROR_VALUES array:
const FILTER_ERROR_VALUES = ['AbortError: AbortError', 'cancel timeout'];
Option C: Filter by partial message match (for dynamic messages)
Add to isFilterErrorAndSkipSentry function:
// Platform-specific filter (group with existing platform checks)
if (platformEnv.isDesktop && error.value) {
if (error.value.includes('YOUR_ERROR_PATTERN')) {
return true;
}
}
// Cross-platform filter
if (error.value && error.value.includes('YOUR_ERROR_PATTERN')) {
return true;
}
3) Implementation pattern
For platform-specific errors, group checks to minimize redundant conditions:
// Desktop-specific error filters (grouped)
if (platformEnv.isDesktop && error.value) {
// Filter 1
if (error.value.includes('Pattern1')) {
return true;
}
// Filter 2 (check shorter string first for performance)
if (
error.value.includes('ShortPattern') &&
error.value.includes('LongerPatternForSpecificity')
) {
return true;
}
}
4) Verify changes
yarn eslint packages/shared/src/modules3rdParty/sentry/basicOptions.ts --quiet
Platform Detection
Use platformEnv for platform-specific filtering:
import platformEnv from '@onekeyhq/shared/src/platformEnv';
platformEnv.isDesktop // Electron desktop app
platformEnv.isNative // React Native (iOS/Android)
platformEnv.isWeb // Web browser
platformEnv.isExtension // Browser extension
platformEnv.isWebEmbed // Embedded web components
Best Practices
- Check shorter strings first - Better performance for
includes()chains - Group platform checks - Avoid redundant
platformEnvevaluations - Add comments - Explain why the error is being filtered
- Preserve local logging - Filtered errors still get logged via
onErrorcallback - Be specific - Use multiple
includes()for dynamic messages to avoid false positives
Example: Filtering Electron webview errors
// Filter Electron webview connection closed error (network interruption during webview loading)
// Check shorter string first for better performance
if (
error.value.includes('ERR_CONNECTION_CLOSED') &&
error.value.includes('GUEST_VIEW_MANAGER_CALL')
) {
return true;
}
Related Files
- Main Sentry config:
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
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 1000以上
1ヶ月以内に更新
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon


