Skip to main content

Class: WebAuthnError

Defined in: src/auth/errors.ts:199

WebAuthn error.

Remarks​

Thrown when WebAuthn operations fail. HTTP mapping: 400 Bad Request or 401 Unauthorized

Extends​

Constructors​

new WebAuthnError()​

new WebAuthnError(webauthnError, message, cause?): WebAuthnError

Defined in: src/auth/errors.ts:220

Creates a new WebAuthnError.

Parameters​

webauthnError​

Specific error type

"registration_failed" | "authentication_failed" | "credential_not_found" | "invalid_challenge" | "counter_mismatch" | "attestation_failed"

message​

string

Error message

cause?​

Error

Original error

Returns​

WebAuthnError

Overrides​

ChiveError.constructor

Properties​

cause?​

readonly optional cause: Error

Defined in: src/types/errors.ts:71

Original error that caused this error (if any).

Remarks​

Error chaining allows tracking the full error context through multiple layers of the application. Useful for debugging complex error scenarios.

Example​

try {
await fetchData();
} catch (err) {
throw new ValidationError('Failed to validate data', 'field', 'required', err as Error);
}

Inherited from​

ChiveError.cause


code​

readonly code: "WEBAUTHN_ERROR" = 'WEBAUTHN_ERROR'

Defined in: src/auth/errors.ts:200

Machine-readable error code.

Remarks​

Error codes are unique identifiers for error types, enabling programmatic error handling (switch statements, error maps), error tracking in monitoring systems, and client-side error translation (i18n).

Overrides​

ChiveError.code


webauthnError​

readonly webauthnError: "registration_failed" | "authentication_failed" | "credential_not_found" | "invalid_challenge" | "counter_mismatch" | "attestation_failed"

Defined in: src/auth/errors.ts:205

Specific WebAuthn error type.