Better error handling
This commit is contained in:
parent
b390363b25
commit
e3b3f8fac1
25 changed files with 52 additions and 52 deletions
|
|
@ -17,7 +17,7 @@ export async function resolveUser(username: string, host: string | null, option?
|
|||
logger.info(`return local user: ${usernameLower}`);
|
||||
return await Users.findOne({ usernameLower, host: null }).then(u => {
|
||||
if (u == null) {
|
||||
throw 'user not found';
|
||||
throw new Error('user not found');
|
||||
} else {
|
||||
return u;
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ export async function resolveUser(username: string, host: string | null, option?
|
|||
logger.info(`return local user: ${usernameLower}`);
|
||||
return await Users.findOne({ usernameLower, host: null }).then(u => {
|
||||
if (u == null) {
|
||||
throw 'user not found';
|
||||
throw new Error('user not found');
|
||||
} else {
|
||||
return u;
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ export async function resolveUser(username: string, host: string | null, option?
|
|||
logger.info(`return resynced remote user: ${acctLower}`);
|
||||
return await Users.findOne({ uri: self.href }).then(u => {
|
||||
if (u == null) {
|
||||
throw 'user not found';
|
||||
throw new Error('user not found');
|
||||
} else {
|
||||
return u;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue