mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-04 02:09:24 +02:00
Refactor exception usage
This commit is contained in:
parent
d68b425e0e
commit
8d65c5d777
148 changed files with 2061 additions and 769 deletions
|
@ -21,6 +21,8 @@ import { config } from '../../../config'
|
|||
import { VisibleConnectedDevicesManager } from '../../../connected-devices'
|
||||
import { Database } from '../../../database'
|
||||
import { generateVersionId } from '../../../util/token'
|
||||
import { SourceUserNotFoundException } from './exception/illegal-state'
|
||||
import { InvalidChildActionIntegrityValue } from './exception/integrity'
|
||||
|
||||
export class Cache {
|
||||
readonly familyId: string
|
||||
|
@ -84,7 +86,7 @@ export class Cache {
|
|||
})
|
||||
|
||||
if (!userEntryUnsafe) {
|
||||
throw new Error('user not found')
|
||||
throw new SourceUserNotFoundException()
|
||||
}
|
||||
|
||||
return userEntryUnsafe.secondPasswordHash
|
||||
|
@ -102,11 +104,11 @@ export class Cache {
|
|||
})
|
||||
|
||||
if (!userEntryUnsafe) {
|
||||
throw new Error('user not found')
|
||||
throw new SourceUserNotFoundException()
|
||||
}
|
||||
|
||||
if (!userEntryUnsafe.secondPasswordHash) {
|
||||
throw new Error('user does not have a password')
|
||||
throw new InvalidChildActionIntegrityValue()
|
||||
}
|
||||
|
||||
return userEntryUnsafe.secondPasswordHash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue