-
Notifications
You must be signed in to change notification settings - Fork 247
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
fix: error types #1003
fix: error types #1003
Conversation
🦋 Changeset detectedLatest commit: 726b795 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
LGTM, wonder if we should add Changesets here?
Not sure, what do you think @esaminu ? |
@marcinbodnar imo this would be a patch version bump since it's a backward compatible fix |
c331912
to
47c2bf2
Compare
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.
LGTM!
Motivation
This is a partial restoration of changes from #910 . At this moment near-api-js is not returning proper error types for errors:
AccountDoesNotExist
,AccessKeyDoesNotExist
,CodeDoesNotExist
,InvalidNonce
. Issue: #980 .Description
getErrorTypeFromErrorMessage
function, with a default value change. The previous implementation was always returningUntypedError
if the error message doesn't match pointed strings, which means it could possibly change the type even if it already exists, which was not ideal - this function should return the proper type if it matches, and don't change the type if not matches. If the request doesn't have a type at all, we have a proper condition to change the type if it doesn't exist in theTypedError
class.getErrorTypeFromErrorMessage
inJsonRpcProvider.query
method, but with the current message.getErrorTypeFromErrorMessage
inJsonRpcProvider.sendJsonRpc
method.UntypedError
case from it.Checklist