@@ -2,7 +2,6 @@ package com.cycode.plugin.sentry
22
33import com.cycode.plugin.Consts
44import com.cycode.plugin.CycodeBundle
5- import com.intellij.diagnostic.IdeaReportingEvent
65import com.intellij.ide.DataManager
76import com.intellij.idea.IdeaLogger
87import com.intellij.openapi.actionSystem.CommonDataKeys
@@ -18,8 +17,16 @@ import io.sentry.Sentry
1817import io.sentry.SentryEvent
1918import io.sentry.SentryLevel
2019import java.awt.Component
20+ import java.io.PrintWriter
21+ import java.io.StringWriter
2122
2223
24+ fun getStackTraceAsString (throwable : Throwable ): String {
25+ val sw = StringWriter ()
26+ throwable.printStackTrace(PrintWriter (sw))
27+ return sw.toString()
28+ }
29+
2330class SentryErrorReporter : ErrorReportSubmitter () {
2431 override fun getReportActionText (): String {
2532 return CycodeBundle .message(" reportActionButton" )
@@ -38,20 +45,19 @@ class SentryErrorReporter : ErrorReportSubmitter() {
3845 object : Task .Backgroundable (project, CycodeBundle .message(" sentryReporting" ), false ) {
3946 override fun run (indicator : ProgressIndicator ) {
4047 for (ideaEvent in events) {
41- if (ideaEvent !is IdeaReportingEvent ) {
42- continue
43- }
44-
4548 val event = SentryEvent ()
4649 event.level = SentryLevel .ERROR
4750 event.release = Consts .SENTRY_RELEASE
48- event.throwable = ideaEvent.data. throwable
51+ event.throwable = ideaEvent.throwable
4952 event.serverName = " "
5053
5154 event.extras = mapOf (
52- " message" to ideaEvent.data. message,
55+ " message" to ideaEvent.message,
5356 " additional_info" to additionalInfo,
5457 " last_action" to IdeaLogger .ourLastActionId,
58+ // before 2025.1 it will contain more useful information
59+ // since 2025.1 throwable is close to the original
60+ " stacktrace" to getStackTraceAsString(ideaEvent.throwable)
5561 )
5662
5763 Sentry .captureEvent(event)
0 commit comments