Better error handling

This commit is contained in:
syuilo 2019-04-14 04:17:24 +09:00
parent b390363b25
commit e3b3f8fac1
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
25 changed files with 52 additions and 52 deletions

View file

@ -36,7 +36,7 @@ export async function getRemoteUser(userId: User['id']) {
const user = await getUser(userId);
if (!Users.isRemoteUser(user)) {
throw 'user is not a remote user';
throw new Error('user is not a remote user');
}
return user;
@ -49,7 +49,7 @@ export async function getLocalUser(userId: User['id']) {
const user = await getUser(userId);
if (!Users.isLocalUser(user)) {
throw 'user is not a local user';
throw new Error('user is not a local user');
}
return user;