diff options
author | Matthew Miller <matthew@millerti.me> | 2022-04-13 08:54:24 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2022-05-15 21:49:33 -0700 |
commit | 94680cc3e7e7116f67aee232d73b283db9869e54 (patch) | |
tree | 0f76686bba087d36d9000db38a5f3583ef7ad88d | |
parent | 2088c74bb0e05118f5f34a733dc8490730b23ecf (diff) |
Return custom error from parseBackupFlags
-rw-r--r-- | packages/server/src/helpers/parseBackupFlags.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/server/src/helpers/parseBackupFlags.ts b/packages/server/src/helpers/parseBackupFlags.ts index 0ebddb9..c0a1e99 100644 --- a/packages/server/src/helpers/parseBackupFlags.ts +++ b/packages/server/src/helpers/parseBackupFlags.ts @@ -20,10 +20,17 @@ export function parseBackupFlags({ be, bs }: { be: boolean, bs: boolean }): { } if (credentialDeviceType === 'singleDevice' && credentialBackedUp) { - throw new Error( + throw new InvalidBackupFlags( 'Single-device credential indicated that it was backed up, which should be impossible.' ) } return { credentialDeviceType, credentialBackedUp }; } + +class InvalidBackupFlags extends Error { + constructor(message: string) { + super(message); + this.name = 'InvalidBackupFlags'; + } +} |