-
Hello, Is it possible, somehow, to execute some code right before the crash occurs ? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This depends on where the crash is, and how much trouble you are willing to go to. If the crash is in javascript, sure! Install a new default javascript exception handler, and configure react-native-firebase so it chains your handler instead of overriding it - https://rnfirebase.io/app/json-config#crashlytics_javascript_exception_handler_chaining_enabled If it is a javascript crash and you want to run code first, install a global javascript exception handler that does what you need, and take care to preserve chaining so any other handlers are unaffected. Here is an example of how to get the original handler, then install your handler and chain to the original one if you want If it's a native crash, you have similar capabilities but you will have to code a native module that does it, and in that native module you will need to follow standard java/kotlin and/or objective-c/swift strategies to install your crash handler such that you get control as the crash is happening, also taking care to chain to the existing handlers so that crashlytics will still run. That's far out of scope for this package but stackoverflow etc could guide you |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for taking time to write such a reply. |
Beta Was this translation helpful? Give feedback.
This depends on where the crash is, and how much trouble you are willing to go to.
If the crash is in javascript, sure! Install a new default javascript exception handler, and configure react-native-firebase so it chains your handler instead of overriding it -
https://rnfirebase.io/app/json-config#crashlytics_javascript_exception_handler_chaining_enabled
https://invertase.io/blog/react-native-firebase-crashlytics-configuration#configurable-exception-handler-chaining
If it is a javascript crash and you want to run code first, install a global javascript exception handler that does what you need, and take care to preserve chaining so any other handlers are unaffected.
Here is an example of …