Elffuss BraidHub

kikocis/continue public

feat: Report issues to Sentry

Included tags:
* ide_version
* plugin_version
* jcef_supported

To test it, just register an action that throws an exception. As a result, a notification appears + there is a blinking icon in the bottom-right corner. Click on it and select 'Submit to Continue'. User message is also sent to Sentry (you can leave it empty).
Changeset3e3606b02145badfc9606effd3c0421a4f3317f59227e80f9b8b66a65bd6a655
AuthorJakub Blach <jakubblach@gmail.com> · 2025-07-01 00:39 +02:00
CommitterJakub Blach <jakubblach@gmail.com> · 2025-07-01 00:39 +02:00
Parentse2d4558a5911

Browse the files at this changeset

3 files changed

modified extensions/intellij/build.gradle.kts +1 −0
@@ -18,6 +18,7 @@
1818 id("org.jetbrains.qodana") version "0.1.13"
1919 id("org.jetbrains.kotlinx.kover") version "0.7.3"
2020 kotlin("plugin.serialization") version "1.8.0"
21+ id("io.sentry.jvm.gradle") version "5.8.0"
2122 }
2223
2324 group = properties("pluginGroup").get()
added extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorSubmitter.kt +55 −0
@@ -0,0 +1,55 @@
1+package com.github.continuedev.continueintellijextension.error
2+
3+import com.intellij.diagnostic.IdeaReportingEvent
4+import com.intellij.openapi.application.ApplicationInfo
5+import com.intellij.openapi.diagnostic.ErrorReportSubmitter
6+import com.intellij.openapi.diagnostic.IdeaLoggingEvent
7+import com.intellij.openapi.diagnostic.SubmittedReportInfo
8+import com.intellij.openapi.diagnostic.SubmittedReportInfo.SubmissionStatus
9+import com.intellij.ui.jcef.JBCefApp
10+import com.intellij.util.Consumer
11+import io.sentry.Sentry
12+import io.sentry.SentryEvent
13+import io.sentry.protocol.Message
14+import java.awt.Component
15+
16+class ContinueErrorSubmitter : ErrorReportSubmitter() {
17+
18+ init {
19+ Sentry.init { config ->
20+ config.dsn = SENTRY_DSN
21+ config.isSendDefaultPii = false
22+ config.setTag("ide_version", ApplicationInfo.getInstance().build.asString())
23+ config.setTag("jcef_supported", JBCefApp.isSupported().toString())
24+ }
25+ }
26+
27+ override fun getReportActionText() =
28+ "Report to Continue"
29+
30+ override fun submit(
31+ events: Array<out IdeaLoggingEvent?>,
32+ additionalInfo: String?,
33+ parentComponent: Component,
34+ consumer: Consumer<in SubmittedReportInfo>
35+ ): Boolean {
36+ try {
37+ val event = events.filterIsInstance<IdeaReportingEvent>().firstOrNull() ?: return false
38+ val sentryEvent = SentryEvent()
39+ sentryEvent.throwable = event.data.throwable
40+ sentryEvent.message = Message().apply { message = additionalInfo }
41+ sentryEvent.setTag("plugin_version", event.plugin?.version)
42+ Sentry.captureEvent(sentryEvent)
43+ } catch (_: Exception) {
44+ consumer.consume(SubmittedReportInfo(SubmissionStatus.FAILED))
45+ return false
46+ }
47+ consumer.consume(SubmittedReportInfo(SubmissionStatus.NEW_ISSUE))
48+ return true
49+ }
50+
51+ private companion object {
52+ private const val SENTRY_DSN = "https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016"
53+ }
54+
55+}
modified extensions/intellij/src/main/resources/META-INF/plugin.xml +1 −0
@@ -36,6 +36,7 @@
3636 displayType="BALLOON"/>
3737 <actionPromoter order="last"
3838 implementation="com.github.continuedev.continueintellijextension.actions.ContinueActionPromote"/>
39+ <errorHandler implementation="com.github.continuedev.continueintellijextension.error.ContinueErrorSubmitter"/>
3940 </extensions>
4041
4142 <resource-bundle>messages.MyBundle</resource-bundle>