Changesets · Branches · Tags · Compare
| Changeset | 960dd3a6efa17b606c1c8aa827243f8bd389bbfebd30050e72b8d86a9a0bf528 |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-07-01 11:33 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-07-01 11:33 -07:00 |
| Parents | c6c73bdf5975, 31d8760ef327 |
4 files changed
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt +5 −2
| @@ -6,6 +6,7 @@ | ||
| 6 | 6 | import com.github.continuedev.continueintellijextension.auth.ContinueAuthService |
| 7 | 7 | import com.github.continuedev.continueintellijextension.editor.DiffStreamService |
| 8 | 8 | import com.github.continuedev.continueintellijextension.editor.EditorUtils |
| 9 | +import com.github.continuedev.continueintellijextension.error.ContinueErrorService | |
| 9 | 10 | import com.github.continuedev.continueintellijextension.protocol.* |
| 10 | 11 | import com.github.continuedev.continueintellijextension.services.* |
| 11 | 12 | import com.github.continuedev.continueintellijextension.utils.* |
| @@ -462,8 +463,10 @@ | ||
| 462 | 463 | println("Unknown message type: $messageType") |
| 463 | 464 | } |
| 464 | 465 | } |
| 465 | - } catch (error: Exception) { | |
| 466 | - ide.showToast(ToastType.ERROR, " Error handling message of type $messageType: $error") | |
| 466 | + } catch (exception: Exception) { | |
| 467 | + val exceptionMessage = "Error handling message of type $messageType: $exception" | |
| 468 | + service<ContinueErrorService>().report(exception, exceptionMessage) | |
| 469 | + ide.showToast(ToastType.ERROR, exceptionMessage) | |
| 467 | 470 | } |
| 468 | 471 | } |
| 469 | 472 | } |
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +10 −15
| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | package com.github.continuedev.continueintellijextension.`continue` |
| 2 | 2 | |
| 3 | 3 | import com.github.continuedev.continueintellijextension.* |
| 4 | -import com.github.continuedev.continueintellijextension.constants.getContinueGlobalPath | |
| 5 | 4 | import com.github.continuedev.continueintellijextension.constants.ContinueConstants |
| 6 | -import com.github.continuedev.continueintellijextension.`continue`.GitService | |
| 5 | +import com.github.continuedev.continueintellijextension.constants.getContinueGlobalPath | |
| 6 | +import com.github.continuedev.continueintellijextension.error.ContinueErrorService | |
| 7 | 7 | import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings |
| 8 | 8 | import com.github.continuedev.continueintellijextension.services.ContinuePluginService |
| 9 | 9 | import com.github.continuedev.continueintellijextension.utils.* |
| @@ -11,7 +11,6 @@ | ||
| 11 | 11 | import com.intellij.execution.configurations.GeneralCommandLine |
| 12 | 12 | import com.intellij.execution.util.ExecUtil |
| 13 | 13 | import com.intellij.ide.BrowserUtil |
| 14 | -import com.intellij.ide.plugins.PluginManager | |
| 15 | 14 | import com.intellij.ide.plugins.PluginManagerCore |
| 16 | 15 | import com.intellij.lang.annotation.HighlightSeverity |
| 17 | 16 | import com.intellij.notification.NotificationAction |
| @@ -38,9 +37,7 @@ | ||
| 38 | 37 | import java.io.File |
| 39 | 38 | import java.io.FileInputStream |
| 40 | 39 | import java.io.InputStreamReader |
| 41 | -import java.net.URI | |
| 42 | 40 | import java.nio.charset.Charset |
| 43 | -import java.nio.file.Paths | |
| 44 | 41 | |
| 45 | 42 | class IntelliJIDE( |
| 46 | 43 | private val project: Project, |
| @@ -344,11 +341,10 @@ | ||
| 344 | 341 | command.setWorkDirectory(project.basePath) |
| 345 | 342 | val results = ExecUtil.execAndGetOutput(command).stdout |
| 346 | 343 | return results.split("\n") |
| 347 | - } catch (e: Exception) { | |
| 348 | - showToast( | |
| 349 | - ToastType.ERROR, | |
| 350 | - "Error executing ripgrep: ${e.message}" | |
| 351 | - ) | |
| 344 | + } catch (exception: Exception) { | |
| 345 | + val message = "Error executing ripgrep: ${exception.message}" | |
| 346 | + service<ContinueErrorService>().report(exception, message) | |
| 347 | + showToast(ToastType.ERROR, message) | |
| 352 | 348 | return emptyList() |
| 353 | 349 | } |
| 354 | 350 | } else { |
| @@ -386,11 +382,10 @@ | ||
| 386 | 382 | |
| 387 | 383 | command.setWorkDirectory(project.basePath) |
| 388 | 384 | return ExecUtil.execAndGetOutput(command).stdout |
| 389 | - } catch (e: Exception) { | |
| 390 | - showToast( | |
| 391 | - ToastType.ERROR, | |
| 392 | - "Error executing ripgrep: ${e.message}" | |
| 393 | - ) | |
| 385 | + } catch (exception: Exception) { | |
| 386 | + val message = "Error executing ripgrep: ${exception.message}" | |
| 387 | + service<ContinueErrorService>().report(exception, message) | |
| 388 | + showToast(ToastType.ERROR, message) | |
| 394 | 389 | return "Error: Unable to execute ripgrep command." |
| 395 | 390 | } |
| 396 | 391 | } else { |
added extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt +50 −0
| @@ -0,0 +1,50 @@ | ||
| 1 | +package com.github.continuedev.continueintellijextension.error | |
| 2 | + | |
| 3 | +import com.intellij.ide.plugins.PluginManagerCore | |
| 4 | +import com.intellij.openapi.application.ApplicationInfo | |
| 5 | +import com.intellij.openapi.components.Service | |
| 6 | +import com.intellij.openapi.diagnostic.Attachment | |
| 7 | +import com.intellij.openapi.diagnostic.Logger | |
| 8 | +import com.intellij.openapi.extensions.PluginId | |
| 9 | +import com.intellij.ui.jcef.JBCefApp | |
| 10 | +import io.sentry.Hint | |
| 11 | +import io.sentry.Sentry | |
| 12 | +import io.sentry.SentryEvent | |
| 13 | +import io.sentry.protocol.Message | |
| 14 | + | |
| 15 | +private typealias SentryAttachment = io.sentry.Attachment | |
| 16 | + | |
| 17 | +@Service | |
| 18 | +class ContinueErrorService { | |
| 19 | + private val log = Logger.getInstance(ContinueErrorService::class.java) | |
| 20 | + | |
| 21 | + init { | |
| 22 | + Sentry.init { config -> | |
| 23 | + config.dsn = SENTRY_DSN | |
| 24 | + config.isSendDefaultPii = false | |
| 25 | + config.setTag("ide_version", ApplicationInfo.getInstance().build.asString()) | |
| 26 | + config.setTag("jcef_supported", JBCefApp.isSupported().toString()) | |
| 27 | + config.setTag("plugin_version", PluginManagerCore.getPlugin(PluginId.getId(PLUGIN_ID))?.version) | |
| 28 | + } | |
| 29 | + } | |
| 30 | + | |
| 31 | + fun report( | |
| 32 | + throwable: Throwable, | |
| 33 | + message: String? = null, | |
| 34 | + attachments: List<Attachment>? = null | |
| 35 | + ) { | |
| 36 | + val sentryEvent = SentryEvent() | |
| 37 | + sentryEvent.throwable = throwable | |
| 38 | + sentryEvent.message = Message().apply { this.message = message } | |
| 39 | + val hint = Hint.withAttachments(attachments?.map { SentryAttachment(it.bytes, it.path) }) | |
| 40 | + Sentry.captureEvent(sentryEvent, hint) | |
| 41 | + log.warn("Problem sent to Sentry: $message", throwable) | |
| 42 | + } | |
| 43 | + | |
| 44 | + private companion object { | |
| 45 | + private const val PLUGIN_ID = "com.github.continuedev.continueintellijextension" | |
| 46 | + private const val SENTRY_DSN = | |
| 47 | + "https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016" | |
| 48 | + } | |
| 49 | + | |
| 50 | +} | |
| No newline at the end of the file |
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorSubmitter.kt +8 −24
| @@ -1,29 +1,16 @@ | ||
| 1 | 1 | package com.github.continuedev.continueintellijextension.error |
| 2 | 2 | |
| 3 | 3 | import com.intellij.diagnostic.IdeaReportingEvent |
| 4 | -import com.intellij.openapi.application.ApplicationInfo | |
| 4 | +import com.intellij.openapi.components.service | |
| 5 | 5 | import com.intellij.openapi.diagnostic.ErrorReportSubmitter |
| 6 | 6 | import com.intellij.openapi.diagnostic.IdeaLoggingEvent |
| 7 | 7 | import com.intellij.openapi.diagnostic.SubmittedReportInfo |
| 8 | 8 | import com.intellij.openapi.diagnostic.SubmittedReportInfo.SubmissionStatus |
| 9 | -import com.intellij.ui.jcef.JBCefApp | |
| 10 | 9 | import com.intellij.util.Consumer |
| 11 | -import io.sentry.Sentry | |
| 12 | -import io.sentry.SentryEvent | |
| 13 | -import io.sentry.protocol.Message | |
| 14 | 10 | import java.awt.Component |
| 15 | 11 | |
| 16 | 12 | class ContinueErrorSubmitter : ErrorReportSubmitter() { |
| 17 | 13 | |
| 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 | 14 | override fun getReportActionText() = |
| 28 | 15 | "Report to Continue" |
| 29 | 16 | |
| @@ -34,12 +21,13 @@ | ||
| 34 | 21 | consumer: Consumer<in SubmittedReportInfo> |
| 35 | 22 | ): Boolean { |
| 36 | 23 | 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) | |
| 24 | + val event = events.filterIsInstance<IdeaReportingEvent>() | |
| 25 | + .firstOrNull() ?: return false | |
| 26 | + service<ContinueErrorService>().report( | |
| 27 | + throwable = event.data.throwable, | |
| 28 | + message = additionalInfo ?: event.data.message, | |
| 29 | + attachments = event.data.allAttachments | |
| 30 | + ) | |
| 43 | 31 | } catch (_: Exception) { |
| 44 | 32 | consumer.consume(SubmittedReportInfo(SubmissionStatus.FAILED)) |
| 45 | 33 | return false |
| @@ -48,8 +36,4 @@ | ||
| 48 | 36 | return true |
| 49 | 37 | } |
| 50 | 38 | |
| 51 | - private companion object { | |
| 52 | - private const val SENTRY_DSN = "https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016" | |
| 53 | - } | |
| 54 | - | |
| 55 | 39 | } |