fix: throw when adding sub account owner fails#347
Open
Snowmanzx wants to merge 1 commit into
Open
Conversation
The catch block in sendRequestToSubAccountSigner used return standardErrors.provider.unauthorized(...). That factory returns an error object so the promise resolved with the error instead of rejecting and the caller used it as a successful result. Changed return to throw. Added a regression test.
Collaborator
🟡 Heimdall Review Status
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
sendRequestToSubAccountSigner swallowed errors when handleAddSubAccountOwner failed.
The catch block did
return standardErrors.provider.unauthorized(...). That factory returns an EthereumProviderError, it does not throw. So the async function resolved with the error object as its value instead of rejecting. The only caller awaits the result and returns it so its catch never runs and the dApp gets the error object back as if it were a valid result.Changed return to throw, which matches how the rest of the function reports errors (assertPresence throws the same error type above).
Added a test in the auto sub account block that makes handleAddSubAccountOwner reject and checks that request rejects.
Closes #326