diff options
author | Matthew Miller <matthew@millerti.me> | 2022-03-08 20:42:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 20:42:52 -0800 |
commit | 30ed8e8913ab59f97587258b4a2f5e3e8b867f5b (patch) | |
tree | ba4859ee4b70b0ca646d631d2c14d1e1981a386f /packages/browser/src/helpers/structs.ts | |
parent | 4a8fb255d4fd6fbc146dedf0a2efc938b99f5973 (diff) | |
parent | c62c1ce7451cb3876851c802d52254dd9fe6d91c (diff) |
Merge pull request #184 from MasterKale/feat/identify-errors
feat/identify-errors
Diffstat (limited to 'packages/browser/src/helpers/structs.ts')
-rw-r--r-- | packages/browser/src/helpers/structs.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/browser/src/helpers/structs.ts b/packages/browser/src/helpers/structs.ts new file mode 100644 index 0000000..66b6d63 --- /dev/null +++ b/packages/browser/src/helpers/structs.ts @@ -0,0 +1,23 @@ +/** + * 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. + */ +export class WebAuthnError extends Error { + constructor(message: string) { + super(message); + this.name = 'WebAuthnError'; + } +} |