-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Add synchronous storeCrashReport method to RaygunClient #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -353,6 +353,42 @@ - (void)sendMessage:(RaygunMessage *)message { | |
| } | ||
| } | ||
|
|
||
| - (BOOL)storeCrashReport:(RaygunMessage *)message { | ||
| if (message == nil) { | ||
| [RaygunLogger logWarning:@"Failed to store crash report - Message object cannot be nil"]; | ||
| return NO; | ||
| } | ||
|
|
||
| // Call groupingKeyProvider if it's set | ||
| if (self.groupingKeyProvider != nil && message.details != nil) { | ||
| NSString *groupingKey = self.groupingKeyProvider(message.details); | ||
|
|
||
| if (groupingKey != nil && ![groupingKey isEqualToString:@""]) { | ||
| message.details.groupingKey = groupingKey; | ||
| [RaygunLogger logDebug:@"Applied custom grouping key from provider: %@", groupingKey]; | ||
| } | ||
| } | ||
|
|
||
| BOOL send = YES; | ||
| if (_beforeSendMessage != nil) { | ||
| send = _beforeSendMessage(message); | ||
| } | ||
|
|
||
| if (!send) { | ||
| [RaygunLogger logDebug:@"Crash report was discarded by beforeSendMessage"]; | ||
| return NO; | ||
| } | ||
|
|
||
| NSString *path = [_fileManager storeCrashReport:message withMaxReportsStored:self.maxReportsStoredOnDevice]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This uses direct access to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably worthwhile aligning. |
||
| if (path) { | ||
| [RaygunLogger logDebug:@"Stored crash report to %@", path]; | ||
| return YES; | ||
| } | ||
|
|
||
| [RaygunLogger logError:@"Failed to store crash report to disk"]; | ||
| return NO; | ||
| } | ||
|
|
||
| - (NSError *)getInnerError:(NSError *)error { | ||
| NSError *innerErrror = error.userInfo[NSUnderlyingErrorKey]; | ||
| if (innerErrror) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
sendMessagealso checksmessage != nilin this condition. Not a bug, just noting the divergence.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also possibly worthwhile making the same as in
sendMessage.