mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.WebAuthnError = void 0;
|
|
/**
|
|
* A custom Error used to return a more nuanced error detailing _why_ one of the eight documented
|
|
* errors in the spec was raised after calling `navigator.credentials.create()` or
|
|
* `navigator.credentials.get()`:
|
|
*
|
|
* - `AbortError`
|
|
* - `ConstraintError`
|
|
* - `InvalidStateError`
|
|
* - `NotAllowedError`
|
|
* - `NotSupportedError`
|
|
* - `SecurityError`
|
|
* - `TypeError`
|
|
* - `UnknownError`
|
|
*
|
|
* Error messages were determined through investigation of the spec to determine under which
|
|
* scenarios a given error would be raised.
|
|
*/
|
|
class WebAuthnError extends Error {
|
|
constructor({ message, code, cause, name, }) {
|
|
// @ts-ignore: help Rollup understand that `cause` is okay to set
|
|
super(message, { cause });
|
|
Object.defineProperty(this, "code", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
this.name = name ?? cause.name;
|
|
this.code = code;
|
|
}
|
|
}
|
|
exports.WebAuthnError = WebAuthnError;
|
|
|