diff options
Diffstat (limited to 'packages/browser/src/helpers')
-rw-r--r-- | packages/browser/src/helpers/identifyAuthenticationError.ts | 2 | ||||
-rw-r--r-- | packages/browser/src/helpers/identifyRegistrationError.ts | 2 | ||||
-rw-r--r-- | packages/browser/src/helpers/webAuthnError.ts (renamed from packages/browser/src/helpers/structs.ts) | 13 |
3 files changed, 12 insertions, 5 deletions
diff --git a/packages/browser/src/helpers/identifyAuthenticationError.ts b/packages/browser/src/helpers/identifyAuthenticationError.ts index 600a2d6..4c0cfe2 100644 --- a/packages/browser/src/helpers/identifyAuthenticationError.ts +++ b/packages/browser/src/helpers/identifyAuthenticationError.ts @@ -1,5 +1,5 @@ import { isValidDomain } from './isValidDomain'; -import { WebAuthnError } from './structs'; +import { WebAuthnError } from './webAuthnError'; /** * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.get()` diff --git a/packages/browser/src/helpers/identifyRegistrationError.ts b/packages/browser/src/helpers/identifyRegistrationError.ts index 9b76454..6134227 100644 --- a/packages/browser/src/helpers/identifyRegistrationError.ts +++ b/packages/browser/src/helpers/identifyRegistrationError.ts @@ -1,5 +1,5 @@ import { isValidDomain } from './isValidDomain'; -import { WebAuthnError } from './structs'; +import { WebAuthnError } from './webAuthnError'; /** * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.create()` diff --git a/packages/browser/src/helpers/structs.ts b/packages/browser/src/helpers/webAuthnError.ts index 8ae01b7..aad98ff 100644 --- a/packages/browser/src/helpers/structs.ts +++ b/packages/browser/src/helpers/webAuthnError.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ /** * 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 @@ -16,8 +17,14 @@ * scenarios a given error would be raised. */ export class WebAuthnError extends Error { - constructor(message: string, name = 'WebAuthnError') { - super(message); - this.name = name; + constructor(message: string, cause: Error, name?: string) { + /** + * `cause` is supported in evergreen browsers, but not IE10, so this ts-ignore is to + * help Rollup complete the ES5 build. + */ + // @ts-ignore + super(message, { cause }) + // this.name = name ?? cause.name; + this.name = name ?? cause.name; } } |