Skip to content

fix(jetbrains): silence non-critical exceptions from PostHog and Sentry#1297

Merged
svarlamov merged 2 commits into
mainfrom
devin/1778184562-jetbrains-silence-noncritical-exceptions
May 11, 2026
Merged

fix(jetbrains): silence non-critical exceptions from PostHog and Sentry#1297
svarlamov merged 2 commits into
mainfrom
devin/1778184562-jetbrains-silence-noncritical-exceptions

Conversation

@svarlamov
Copy link
Copy Markdown
Member

@svarlamov svarlamov commented May 7, 2026

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:

  • Added TelemetryService.getInstanceOrNull() — returns null instead of throwing if the service can't be instantiated (e.g. NoClassDefFoundError when PostHog/Sentry classes fail to load)
  • Wrapped all public TelemetryService methods with top-level try/catch(Throwable) so no telemetry operation can escape
  • Switched all call sites in GitAiService and DocumentTrackerStartupActivity from getInstance() to getInstanceOrNull()?.
  • Wrapped the init block's initializePostHog()/initializeSentry() calls individually so one failing doesn't prevent the other
  • Removed noisy logger.warn/logger.info from shutdown paths

Fixes #1296

Review & Testing Checklist for Human

  • Confirm that catching Throwable (not just Exception) is acceptable — this swallows Error subclasses (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.
  • Verify that fully-silent outer catches (no logging at all) are desired. Currently if something truly unexpected happens in a telemetry method, it vanishes without a trace. Consider whether at least logger.debug would help future debugging without user-facing noise.
  • Install the plugin locally and verify no IDE error dialogs appear when PostHog/Sentry are unreachable (e.g. behind a corporate firewall or with no internet).

Notes

  • Could not run Gradle compilation locally (timeout on this machine), so CI is the first compile check for these changes.
  • The inner existing try-catch blocks (in 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


Open in Devin Review

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-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Qodana for JVM

Analyzed project: agent-support/intellij/

1 new problem were found

Inspection name Severity Problems
Unused symbol 🔶 Warning 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2026.1.0
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Co-Authored-By: Sasha Varlamov <sasha@sashavarlamov.com>
@svarlamov svarlamov merged commit da40bfe into main May 11, 2026
14 of 15 checks passed
@svarlamov svarlamov deleted the devin/1778184562-jetbrains-silence-noncritical-exceptions branch May 11, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jetbrains plugin silence non-critical exceptions

2 participants