Skip to main content

Class: MFARequiredError

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

MFA required error.

Remarks

Thrown when MFA is required but not provided. HTTP mapping: 401 Unauthorized with MFA challenge

Extends

Constructors

new MFARequiredError()

new MFARequiredError(challengeId, methods, expiresAt): MFARequiredError

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

Creates a new MFARequiredError.

Parameters

challengeId

string

Challenge identifier

methods

readonly string[]

Available MFA methods

expiresAt

Date

Challenge expiration

Returns

MFARequiredError

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


challengeId

readonly challengeId: string

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

Challenge ID for MFA completion.


code

readonly code: "MFA_REQUIRED" = 'MFA_REQUIRED'

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

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


expiresAt

readonly expiresAt: Date

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

Challenge expiration timestamp.


methods

readonly methods: readonly string[]

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

Available MFA methods.