Skip to content
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

Change error name to reflect the type #191

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

felixmosh
Copy link
Contributor

fixes #190

@MasterKale
Copy link
Owner

Hmm, I don't like the idea of calling an error "WebAuthnError" and then allowing for its name to be overridden so error.name would never be "WebAuthnError". The better way to do this is probably to throw basic Error's instead and set the name to the original WebAuthn error so that RPs like you can continue to rely on error.name for detection. Then just drop "WebAuthnError" completely so what the functionality really becomes is an overriding of the description of the error.

@MasterKale
Copy link
Owner

I experimented with some potential solutions tonight and after hitting a bunch of dead ends I do think your proposed solution is the only way forward. I'm going to request a fix, and once that's done this should be good to merge.

@felixmosh
Copy link
Contributor Author

I've updated tests, thank you

@MasterKale MasterKale merged commit 8034e6e into MasterKale:master Apr 13, 2022
@MasterKale
Copy link
Owner

@felixmosh Thank you for your contribution! This is a great improvement to the error detection logic 🚀

@MasterKale MasterKale added the package:browser @simplewebauthn/browser label Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:browser @simplewebauthn/browser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Differentiate browser / server errors by name
2 participants