better error message when group not found
This commit is contained in:
@@ -162,7 +162,7 @@ async function setMembership(userId, groupIds) {
|
||||
});
|
||||
|
||||
const [error] = await safe(database.transaction(queries));
|
||||
if (error && error.code === 'ER_NO_REFERENCED_ROW_2') throw new BoxError(BoxError.NOT_FOUND, error.message);
|
||||
if (error && error.code === 'ER_NO_REFERENCED_ROW_2') throw new BoxError(BoxError.NOT_FOUND, 'Group not found');
|
||||
if (error && error.code === 'ER_DUP_ENTRY') throw new BoxError(BoxError.CONFLICT, 'Already member');
|
||||
if (error) throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user