diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-14 04:17:24 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-14 04:17:24 +0900 |
| commit | e3b3f8fac14fb4c4d150fb31c11ead1a193a36e0 (patch) | |
| tree | 021d39efbb8ec59d098e06603bf86dae670773e0 /src/server/api/authenticate.ts | |
| parent | Update CHANGELOG.md (diff) | |
| download | sharkey-e3b3f8fac14fb4c4d150fb31c11ead1a193a36e0.tar.gz sharkey-e3b3f8fac14fb4c4d150fb31c11ead1a193a36e0.tar.bz2 sharkey-e3b3f8fac14fb4c4d150fb31c11ead1a193a36e0.zip | |
Better error handling
Diffstat (limited to 'src/server/api/authenticate.ts')
| -rw-r--r-- | src/server/api/authenticate.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/api/authenticate.ts b/src/server/api/authenticate.ts index 5c2b7e45cf..ecf4a82c45 100644 --- a/src/server/api/authenticate.ts +++ b/src/server/api/authenticate.ts @@ -14,7 +14,7 @@ export default async (token: string): Promise<[User | null | undefined, App | nu .findOne({ token }); if (user == null) { - throw 'user not found'; + throw new Error('user not found'); } return [user, null]; @@ -24,7 +24,7 @@ export default async (token: string): Promise<[User | null | undefined, App | nu }); if (accessToken == null) { - throw 'invalid signature'; + throw new Error('invalid signature'); } const app = await Apps |