Skip to content

Commit b371a92

Browse files
authored
feat(ios): enhance fatal issue reports with more reason info (#440)
combine available fields (if any) to construct the reason for the exception
1 parent 95a288a commit b371a92

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

platform/swift/source/reports/DiagnosticEventReporter.m

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,25 @@ static bool serialize_diagnostic(BDProcessorHandle handle, NSString *sdk_version
335335
#undef print_case
336336

337337
static NSString *reason_for_crash(MXCrashDiagnostic *event, NSString *name) {
338+
NSMutableArray <NSString *> *components = [NSMutableArray new];
338339
if (@available(iOS 17, macOS 14, *)) {
339340
if (event.exceptionReason) {
340-
return event.exceptionReason.composedMessage;
341+
// exception name included here instead of in the name_for_crash
342+
// to avoid cases where devices on iOS <17 have a different name
343+
// and thus a different issue grouping
344+
[components addObject:[NSString stringWithFormat:@"%@: %@",
345+
event.exceptionReason.exceptionName,
346+
event.exceptionReason.composedMessage]];
341347
}
342348
}
343349
if (event.terminationReason) {
344-
return event.terminationReason;
350+
[components addObject:event.terminationReason];
351+
}
352+
if (event.virtualMemoryRegionInfo) {
353+
[components addObject:event.virtualMemoryRegionInfo];
354+
}
355+
if ([components count]) {
356+
return [components componentsJoinedByString:@".\n"];
345357
}
346358
if (event.exceptionCode.longValue) {
347359
return [NSString stringWithFormat:@"code: %ld, signal: %@",

0 commit comments

Comments
 (0)