Closed distinctdan closed 5 years ago
I'd love to have this functionality !
@distinctdan I see you rebased the master. But we will get this merged once we fix the issue of the breaking change due to Firebase.
@distinctdan I have merged your PR and made some changes to your code at https://github.com/wizpanda/cordova-plugin-firebase-lib/commit/bfd4bf60f0722e8186a82d53880f17698c38f93f to make it more readable and DRY.
Also, instead of mixing the same method, I have created a new method logJSError
which makes it more readable and backward compatible for the users.
Please let me know your thoughts.
@sagrawal31 Thanks for looking into it. However, I see some issues with your changes, and it looks like you didn't test enough before you merged because you've got typos and you broke functionality. Here are my observations:
xports.logError
should be exports.logError
JavaScriptException
class, good idea.JavaScriptException
is still created if the user doesn't pass a stack, on the line Crashlytics.logException(new JavaScriptException(message));
, but your new implementation looks like it will throw in this case when it hits stackTrace.length()
exports.fetch
or exports.verifyPhoneNumber
for examples. At the end of the day, I think this library could have been designed better to put the success and error callbacks as the first arguments, and have all other arguments last, but changing that would be a breaking change. I'd ask you to please consider changing it back.Oh, one other thing I forgot to do, after we get everything straightened out, we'll need to update the docs to reflect the changes.
I agree with the points you mentioned. It's true that I didn't enough and only did the sanity checks but I believed the PR coming to repositories are testing enough.
But yeah, I should have tested it thoroughly after the changes. But thanks for pointing those out. I'll make the necessary changes.
Oh, one other thing I forgot to do, after we get everything straightened out, we'll need to update the docs to reflect the changes.
Couldn't agree more that DOCs are equally important
@sagrawal31 Looks great, thanks for taking a look at it. I've also done another PR to add an example to the docs of how to use StackTrace.js to pass a stacktrace to the method: https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/22
Hi, I've done these fixes for my own project and wanted to make them available to others as well.