Skip to content

Server error codes #646

Description

@Mykhailo-Sichkaruk

Proposal

It would be great if server lib had codes for errors.
There are such error codes for frontend - #367 .

Consider example -

  • you want to run some logic if counter is lower than expected,
  • and you want to run another logic if origin mismathes
  • else rethrow

I want to it to look like this in my code:

			try {
				const verification = await verifyAuthenticationResponse({
				...
				});
			} catch (error: WebAuthnError) {
			        if (error.code === 'COUNTER_TOO_LOW') {
			            // logout user
			            // delete passkey
			        } else if (error.code === 'ORIGIN_MISMATCH'){
			            throw new Error('I'm a teapot');
                                } else {
                                    throw error;
                                }
			}

Just say what do you think about it generally and we can start discussing implementation details.
I want to contribute.


P.S.: thank you for such great library

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions