Changesets · Branches · Tags · Compare
| Changeset | 3e3606b02145badfc9606effd3c0421a4f3317f59227e80f9b8b66a65bd6a655 |
|---|---|
| Author | Jakub Blach <jakubblach@gmail.com> · 2025-07-01 00:39 +02:00 |
| Committer | Jakub Blach <jakubblach@gmail.com> · 2025-07-01 00:39 +02:00 |
| Parents | e2d4558a5911 |
3 files changed
modified extensions/intellij/build.gradle.kts +1 −0
| @@ -18,6 +18,7 @@ | ||
| 18 | 18 | id("org.jetbrains.qodana") version "0.1.13" |
| 19 | 19 | id("org.jetbrains.kotlinx.kover") version "0.7.3" |
| 20 | 20 | kotlin("plugin.serialization") version "1.8.0" |
| 21 | + id("io.sentry.jvm.gradle") version "5.8.0" | |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | 24 | 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 @@ | ||
| 36 | 36 | displayType="BALLOON"/> |
| 37 | 37 | <actionPromoter order="last" |
| 38 | 38 | implementation="com.github.continuedev.continueintellijextension.actions.ContinueActionPromote"/> |
| 39 | + <errorHandler implementation="com.github.continuedev.continueintellijextension.error.ContinueErrorSubmitter"/> | |
| 39 | 40 | </extensions> |
| 40 | 41 | |
| 41 | 42 | <resource-bundle>messages.MyBundle</resource-bundle> |