Repository navigation
[Crashlytics] Refactor non-fatal error logging to use FIRCLSNonFatalError model - #16139
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors non-fatal error recording by introducing the FIRCLSNonFatalError class to capture execution context at initialization. Feedback recommends restoring an early return for nil errors in FIRCrashlytics.m to prevent unnecessary processing and explicitly copying properties in the FIRCLSNonFatalError initializer to ensure data integrity and immutability.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Generated by 🚫 Danger |
…Error` model (#16139) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Description
Historically, non-fatal errors in Crashlytics were simple enough that passing a few parameters to a helper function sufficed. However, with the added complexity of Crashlytics' asynchronous initialization, we now need to explicitly separate the data collection logic from the disk recording logic to ensure we preserve the correct execution context.
This PR addresses that complexity by introducing a dedicated
FIRCLSNonFatalErrorclass. This model records the state of the error at initialization and provides another method to write the error to disk, effectively seperating the 2.Related Issues & PRs
userInfodictionary before the error is written to disk. The logic to modify the userinfo dict can move to a method within this class instead of being inrecordError(error:, userInfo:)inFIRCrashlytics.mand this method should be called in the initializer for this class to update the dict if needed.Changes Made
FIRCLSNonFatalErrorclass inCrashlytics/Models/to act as an immutable state snapshot.recordError:userInfo:to initialize this model before entering the async queue, guaranteeing the origin stack trace is preserved regardless of how long initialization takes.Testing & Verification
./scripts/check.sh).#no-changelog