Skip to content

Commit dea2db0

Browse files
authored
CM-43972 - Fix usage of internal API in 2025.1 (#84)
1 parent 734f7ff commit dea2db0

File tree

5 files changed

+30
-19
lines changed

5 files changed

+30
-19
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
plugins.gradle.org
3333
teamcity.jetbrains.com
3434
www.jetbrains.com
35+
downloads.gradle.org
3536
3637
- name: Maximize Build Space
3738
run: |
@@ -44,7 +45,7 @@ jobs:
4445
uses: actions/checkout@v4
4546

4647
- name: Gradle Wrapper Validation
47-
uses: gradle/wrapper-validation-action@v1.1.0
48+
uses: gradle/actions/wrapper-validation@v3
4849

4950
- name: Setup Java
5051
uses: actions/setup-java@v3
@@ -53,7 +54,7 @@ jobs:
5354
java-version: 17
5455

5556
- name: Setup Gradle
56-
uses: gradle/gradle-build-action@v2.9.0
57+
uses: gradle/actions/setup-gradle@v3
5758
with:
5859
gradle-home-cache-cleanup: true
5960

@@ -189,7 +190,7 @@ jobs:
189190
java-version: 17
190191

191192
- name: Setup Gradle
192-
uses: gradle/gradle-build-action@v2.9.0
193+
uses: gradle/actions/setup-gradle@v3
193194
with:
194195
gradle-home-cache-cleanup: true
195196

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
## [Unreleased]
66

7+
## [2.4.1] - 2025-01-29
8+
9+
- Fix usage of internal API in 2025.1
10+
711
## [2.4.0] - 2025-01-20
812

913
- Add support for IDEs 2025.1
@@ -139,6 +143,8 @@
139143

140144
The first public release of the plugin.
141145

146+
[2.4.1]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.4.1
147+
142148
[2.4.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.4.0
143149

144150
[2.3.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.3.0
@@ -195,4 +201,4 @@ The first public release of the plugin.
195201

196202
[1.0.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.0.0
197203

198-
[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.4.0...HEAD
204+
[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.4.1...HEAD

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pluginGroup = com.cycode.plugin
44
pluginName = Cycode
55
pluginRepositoryUrl = https://github.com/cycodehq/intellij-platform-plugin
66
# SemVer format -> https://semver.org
7-
pluginVersion = 2.4.0
7+
pluginVersion = 2.4.1
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
pluginSinceBuild = 231

src/main/kotlin/com/cycode/plugin/sentry/SentryErrorReporter.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.cycode.plugin.sentry
22

33
import com.cycode.plugin.Consts
44
import com.cycode.plugin.CycodeBundle
5-
import com.intellij.diagnostic.IdeaReportingEvent
65
import com.intellij.ide.DataManager
76
import com.intellij.idea.IdeaLogger
87
import com.intellij.openapi.actionSystem.CommonDataKeys
@@ -18,8 +17,16 @@ import io.sentry.Sentry
1817
import io.sentry.SentryEvent
1918
import io.sentry.SentryLevel
2019
import 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+
2330
class 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)

src/main/kotlin/com/cycode/plugin/sentry/SentryInit.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ object SentryInit {
2727
}
2828

2929
fun setupScope(userId: String, tenantId: String) {
30-
Sentry.configureScope { scope ->
31-
scope.setTag("tenant_id", tenantId)
32-
scope.user = User().apply {
33-
id = userId
34-
data = mapOf("tenant_id" to tenantId)
35-
}
36-
}
30+
Sentry.setTag("tenant_id", tenantId)
31+
Sentry.setUser(User().apply {
32+
id = userId
33+
data = mapOf("tenant_id" to tenantId)
34+
})
3735
}
3836

3937
private fun isSentryDisabled(): Boolean {

0 commit comments

Comments
 (0)