Skip to content

Commit 694d587

Browse files
authored
fix: establish native exception mechanisms (#5052)
* fix: add tombstone exception mechanism * add changelog * switch the tombstone mechanisms from snake to pascal case.
1 parent af6aa3f commit 694d587

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Changelog
22

3-
# Unreleased
3+
## Unreleased
44

55
### Features
66

77
- Update Android targetSdk to API 36 (Android 16) ([#5016](https://github.com/getsentry/sentry-java/pull/5016))
88

99
### Internal
1010

11+
- Establish new native exception mechanisms to differentiate events generated by `sentry-native` from `ApplicationExitInfo`. ([#5052](https://github.com/getsentry/sentry-java/pull/5052))
1112
- Set `write` permission for `statuses` in the changelog preview GHA workflow. ([#5053](https://github.com/getsentry/sentry-java/pull/5053))
1213

1314
## 8.31.0
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.sentry.android.core.internal.tombstone;
2+
3+
import androidx.annotation.NonNull;
4+
5+
/** Mechanism types for native crashes. */
6+
public enum NativeExceptionMechanism {
7+
TOMBSTONE("Tombstone"),
8+
SIGNAL_HANDLER("signalhandler"),
9+
TOMBSTONE_MERGED("TombstoneMerged");
10+
11+
private final @NonNull String value;
12+
13+
NativeExceptionMechanism(@NonNull final String value) {
14+
this.value = value;
15+
}
16+
17+
@NonNull
18+
public String getValue() {
19+
return value;
20+
}
21+
}

sentry-android-core/src/main/java/io/sentry/android/core/internal/tombstone/TombstoneParser.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ private static Mechanism createMechanismFromSignalInfo(
142142
@NonNull final TombstoneProtos.Signal signalInfo) {
143143

144144
final Mechanism mechanism = new Mechanism();
145-
// this follows the current processing triggers strictly, changing any of these
146-
// alters grouping and name (long-term we might want to have a tombstone mechanism)
147-
mechanism.setType("signalhandler");
145+
mechanism.setType(NativeExceptionMechanism.TOMBSTONE.getValue());
148146
mechanism.setHandled(false);
149147
mechanism.setSynthetic(true);
150148

sentry-android-core/src/test/java/io/sentry/android/core/internal/tombstone/TombstoneParserTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class TombstoneParserTest {
7272
assertNotNull(crashedThreadId)
7373

7474
val mechanism = exception.mechanism
75-
assertEquals("signalhandler", mechanism!!.type)
75+
assertEquals("Tombstone", mechanism!!.type)
7676
assertEquals(false, mechanism.isHandled)
7777
assertEquals(true, mechanism.synthetic)
7878
assertEquals("SIGSEGV", mechanism.meta!!["name"])

0 commit comments

Comments
 (0)