fix(jetbrains): silence non-critical exceptions from PostHog and Sentry#1297
Conversation
Wrap all telemetry call sites so PostHog/Sentry failures never surface as user-facing warnings or errors in the IDE. - Add TelemetryService.getInstanceOrNull() for safe access from call sites - Wrap all public TelemetryService methods with top-level try/catch(Throwable) - Switch GitAiService and startup activity to use getInstanceOrNull() - Catch Throwable (not just Exception) to handle NoClassDefFoundError etc. Fixes #1296 Co-Authored-By: Sasha Varlamov <sasha@sashavarlamov.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Qodana for JVMAnalyzed project: 1 new problem were found
💡 Qodana analysis was run in the pull request mode: only the changed files were checked View the detailed Qodana reportTo be able to view the detailed Qodana report, you can either:
To get - name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2026.1.0
with:
upload-result: trueContact Qodana teamContact us at qodana-support@jetbrains.com
|
Co-Authored-By: Sasha Varlamov <sasha@sashavarlamov.com>
Summary
Ensures that PostHog analytics and Sentry error reporting failures in the JetBrains plugin never surface as user-facing warnings or errors in the IDE.
Changes:
TelemetryService.getInstanceOrNull()— returns null instead of throwing if the service can't be instantiated (e.g.NoClassDefFoundErrorwhen PostHog/Sentry classes fail to load)TelemetryServicemethods with top-leveltry/catch(Throwable)so no telemetry operation can escapeGitAiServiceandDocumentTrackerStartupActivityfromgetInstance()togetInstanceOrNull()?.initblock'sinitializePostHog()/initializeSentry()calls individually so one failing doesn't prevent the otherlogger.warn/logger.infofrom shutdown pathsFixes #1296
Review & Testing Checklist for Human
Throwable(not justException) is acceptable — this swallowsErrorsubclasses (e.g.OutOfMemoryError) in telemetry paths. The rationale is that a telemetry OOM should never crash the IDE plugin, but verify this aligns with your philosophy.logger.debugwould help future debugging without user-facing noise.Notes
captureEvent,captureSentryMessage, etc.) still log at warn level — the new outer catches are a last-resort safety net for unexpected failures only.Link to Devin session: https://app.devin.ai/sessions/8de35c04fd164a14a2f8c57d3f3028b2
Requested by: @svarlamov