Better error handling

This commit is contained in:
syuilo
2019-04-14 04:17:24 +09:00
parent b390363b25
commit e3b3f8fac1
25 changed files with 52 additions and 52 deletions

View File

@ -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