better error message when group not found

This commit is contained in:
Girish Ramakrishnan
2022-12-08 10:16:08 +01:00
parent d7d43c73fe
commit 2346a1c501

View File

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