Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
After reading this comment, it seems that Sentry didn't think
err
is an error object: getsentry/sentry-react-native#391 (comment)err?.original
returns an object inside the error object with more details, so this could potentially resolve the issue.I should note that if a user enters incorrect log in details, they see an error message explaining that the username or password is invalid. This change will not affect that.
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.
When it comes to the
?.
syntax, what will be passed intocaptureException
if theoriginal
property is not onerr
? Probably we would just want to pass inerr
in that case, right?I may just be unfamiliar with
?.
but how does this code differ?or is it more like:
Or is it that we can always guarantee that there is an
err.original
on the error object?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.
err
returns an object with the error, error code, error description, and another object (original
) that contains the error and error description.?.
will check iferr
is undefined before attempting to read what's inside the original object. It was added to prevent anundefined
error from being returned.If original isn't included, then
err
wouldn't be passed into the exception. I didn't include an else because we currently passerr
into Sentry.captureException and get an error message. I thought possibly passing in this object directly could be helpful. The error didn't trigger in development mode for me to confirm if this is truly the solution.From what I can see,
err.original
will be included in theerr
object. However, this is coming fromAuth0
so I can't quite guarantee this won't ever change.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.
Ok, I see now that this is already in a try/catch block for Auth0 specific handling. Thank you for clarifying this!