Skip to content

Commit 7f6dbc9

Browse files
committed
clean up tombstone error handling
1 parent 76ef13c commit 7f6dbc9

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/TombstoneIntegration.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,27 @@ public boolean shouldReportHistorical() {
137137
try {
138138
final InputStream tombstoneInputStream = exitInfo.getTraceInputStream();
139139
if (tombstoneInputStream == null) {
140-
logTombstoneFailure(exitInfo);
140+
options
141+
.getLogger()
142+
.log(
143+
SentryLevel.WARNING,
144+
"No tombstone InputStream available for ApplicationExitInfo from %s",
145+
DateTimeFormatter.ISO_INSTANT.format(
146+
Instant.ofEpochMilli(exitInfo.getTimestamp())));
141147
return null;
142148
}
143149

144150
try (final TombstoneParser parser = new TombstoneParser(tombstoneInputStream)) {
145151
event = parser.parse();
146152
}
147-
} catch (IOException e) {
148-
logTombstoneFailure(exitInfo);
153+
} catch (Throwable e) {
154+
options
155+
.getLogger()
156+
.log(
157+
SentryLevel.WARNING,
158+
"Failed to parse tombstone from %s: %s",
159+
DateTimeFormatter.ISO_INSTANT.format(Instant.ofEpochMilli(exitInfo.getTimestamp())),
160+
e.getMessage());
149161
return null;
150162
}
151163

@@ -159,16 +171,6 @@ public boolean shouldReportHistorical() {
159171

160172
return new ApplicationExitInfoHistoryDispatcher.Report(event, hint, tombstoneHint);
161173
}
162-
163-
@RequiresApi(api = Build.VERSION_CODES.R)
164-
private void logTombstoneFailure(final @NotNull ApplicationExitInfo exitInfo) {
165-
options
166-
.getLogger()
167-
.log(
168-
SentryLevel.WARNING,
169-
"Native crash report from %s does not contain a valid tombstone.",
170-
DateTimeFormatter.ISO_INSTANT.format(Instant.ofEpochMilli(exitInfo.getTimestamp())));
171-
}
172174
}
173175

174176
@ApiStatus.Internal

0 commit comments

Comments
 (0)