1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 18:23:31 +00:00

[EC-598] feat: improve error handling

This commit is contained in:
Andreas Coroiu
2022-12-16 15:23:39 +01:00
parent 555c132fe1
commit 9dd1a65b29
2 changed files with 28 additions and 5 deletions

View File

@@ -54,9 +54,30 @@ export interface CredentialAssertResult {
userHandle: string;
}
export class RequestAbortedError extends Error {
constructor(readonly fallbackRequested = false) {
super("Fido2 request was aborted");
export class Fido2Error extends Error {
constructor(message: string, readonly fallbackRequested = false) {
super(message);
}
}
export class RequestAbortedError extends Fido2Error {
constructor(fallbackRequested = false) {
super("Fido2 request was aborted", fallbackRequested);
}
}
export class NoCredentialFoundError extends Fido2Error {
constructor() {
super("No valid credential found", true);
}
}
export class OriginMismatchError extends Fido2Error {
constructor() {
super(
"Authentication requests must originate from the same source that created the credential.",
false
);
}
}