-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
feat(crashlytics): Extend recordException to provide a possibility to add custom properties per exception and not only globally #825
base: main
Are you sure you want to change the base?
Conversation
* adds the possibility to add custom properties when recording a non-fatal exception as outlined here: > https://firebase.google.com/docs/crashlytics/customize-crash-reports?platform=android#log-excepts
* correct usage of `JSONObject` instead of `JSObject` * testing done
const stacktrace = await StackTrace.fromError(err);
await FirebaseCrashlytics.recordException({
message: '[NOT AN EXCEPTION]',
stacktrace,
customProperties: [
{
type: 'string',
key: 'error_name',
value: err?.name,
},
{
type: 'string',
key: 'error_message',
value: err?.message,
},
{
type: 'string',
key: 'error_type',
value: err?.type,
},
!!err.code && {
type: 'string',
key: 'error_code',
value: err.code,
},
],
}); |
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.
Please also add iOS support if it's supported by the Firebase iOS SDK since this plugin supports both platforms.
actually it looks like its not supported the same way on iOS.. (i also added it to the issue #824) maybe it could be achieved tho..
i just feel like it would be all reported as string then? so theoretically not the same.. but i could be wrong here. |
to quickly follow-up on this topic for iOS: looks like the userinfo-way will not work when using a custom error-model = when a stacktrace is provided: that means the only possibility to somehow achieve this would be to set them as global values before and resetting them right after the report. Crashlytics.crashlytics().setCustomValue("value", forKey: key)
Crashlytics.crashlytics().record(exceptionModel: error)
Crashlytics.crashlytics().setCustomValue(nil, forKey: key) |
In this case just ignore the |
sadly that means there is no way to have both then right? so a stacktrace + custom properties per non-fatal crash which honestly was my initial motivation, since i wanted to debug keychain-errors for ios^^ |
Right. But you could implement the workaround you mentioned here yourself using the plugin API. This does not need to be implemented in the plugin itself. |
valid point... seems to be suboptimal either way 🫤 i will try my luck with implementing this then. |
Yes, i know. Unfortunately, there is nothing we can do about it. It's a limitation of the iOS SDK. Do you still want to finish the PR? |
yes, i think i'm pretty close :) |
…ations as outlined in the changeset/readme * updates the definitions, readme and changeset
sorry, needed to finish some work. i did now implement the iOS-part too, so feel free to have a look and change it accordingly 🙏 actually i forgot that this would not work in the current implementation:
for this there would need to be another method to clear/reset a global value by its key (or provide a dedicated type for it in the |
Pull request checklist
Please check if your PR fulfills the following requirements:
npm run changeset
).