feat: Add synchronous storeCrashReport method to RaygunClient#74
feat: Add synchronous storeCrashReport method to RaygunClient#74miquelbeltran wants to merge 1 commit intomasterfrom
Conversation
- Expose a public storeCrashReport: method that writes a RaygunMessage to disk synchronously - Applies groupingKeyProvider and beforeSendMessage before storing - Stored reports are sent on next launch via sendAllStoredCrashReports - Intended for use in unhandled exception hooks where async sends would not complete before process termination Amp-Thread-ID: https://ampcode.com/threads/T-019c9e51-098e-704c-b1bb-7cd5b9576955 Co-authored-by: Amp <amp@ampcode.com>
| return NO; | ||
| } | ||
|
|
||
| NSString *path = [_fileManager storeCrashReport:message withMaxReportsStored:self.maxReportsStoredOnDevice]; |
There was a problem hiding this comment.
This uses direct access to _fileManager whereas the existing sendMessage method (L328, L346) uses self.fileManager property accessor.
There was a problem hiding this comment.
This is probably worthwhile aligning.
| } | ||
|
|
||
| // Call groupingKeyProvider if it's set | ||
| if (self.groupingKeyProvider != nil && message.details != nil) { |
There was a problem hiding this comment.
Nit: sendMessage also checks message != nil in this condition. Not a bug, just noting the divergence.
There was a problem hiding this comment.
Also possibly worthwhile making the same as in sendMessage.
TheRealAgentK
left a comment
There was a problem hiding this comment.
I think the change is overall fine. Left feedback on @velocitysystems's comments, but I think you could merge this PR either way.
|
As mentioned internally, I will keep the PR open while we test internally and then decide how to move once we collect some crashes |
Purpose
Add a public synchronous
storeCrashReport:method toRaygunClientthat allows external callers to persist aRaygunMessageto disk. This is needed for capturing Kotlin Multiplatform (KMP) unhandled exceptions on iOS, where the crash report must be written synchronously before the process terminates.Approach
storeCrashReport:as a public method onRaygunClient.RaygunFileManagerstorage infrastructure.beforeSendMessageandgroupingKeyProvidercallbacks before storing.BOOLindicating success.Type of change
feat:New feature (non-breaking change which adds functionality)Updates
storeCrashReport:method toRaygunClient.handRaygunClient.mTest plan
storeCrashReport:with a manually constructedRaygunMessageand verify the JSON file is written to the crashes directory.