diff --git a/app/javascript/packages/webauthn/is-expected-error.ts b/app/javascript/packages/webauthn/is-expected-error.ts index 505f5a570d4..04d1c88aca7 100644 --- a/app/javascript/packages/webauthn/is-expected-error.ts +++ b/app/javascript/packages/webauthn/is-expected-error.ts @@ -1,10 +1,17 @@ /** - * Set of expected DOM exceptions, which occur based on some user behavior that is not noteworthy, - * such as declining permissions or timeout due to inactivity. + * Set of expected DOM exceptions, which occur based on some user behavior that is not noteworthy: + * + * - Declining permissions + * - Timeout due to inactivity + * - Invalid state such as duplicate key enrollment * * @see https://webidl.spec.whatwg.org/#idl-DOMException */ -const EXPECTED_DOM_EXCEPTIONS: Set = new Set(['NotAllowedError', 'TimeoutError']); +const EXPECTED_DOM_EXCEPTIONS: Set = new Set([ + 'NotAllowedError', + 'TimeoutError', + 'InvalidStateError', +]); const isExpectedWebauthnError = (error: Error): boolean => error instanceof DOMException && EXPECTED_DOM_EXCEPTIONS.has(error.name);