mirror of
https://github.com/wassname/talk.git
synced 2026-07-07 23:11:14 +08:00
changed custom error to standardized error
This commit is contained in:
@@ -15,14 +15,14 @@ const getActionItem = async ({loaders: {Comments, Users}}, {item_id, item_type})
|
||||
if (item_type === 'COMMENTS') {
|
||||
const comment = await Comments.get.load(item_id);
|
||||
if (!comment) {
|
||||
throw new Error('Comment not found');
|
||||
throw errors.ErrNotFound;
|
||||
}
|
||||
|
||||
return comment;
|
||||
} else if (item_type === 'USERS') {
|
||||
const user = await Users.getByID.load(item_id);
|
||||
if (!user) {
|
||||
throw new Error('User not found');
|
||||
throw errors.ErrNotFound;
|
||||
}
|
||||
|
||||
return user;
|
||||
|
||||
Reference in New Issue
Block a user