misc: added helpful error message

This commit is contained in:
Sheen Capadngan
2024-09-18 14:43:25 +08:00
parent 613b97c93d
commit 19e4a6de4d
2 changed files with 21 additions and 5 deletions
@@ -334,7 +334,7 @@ export const permissionServiceFactory = ({
const isCustomRole = !Object.values(ProjectMembershipRole).includes(role as ProjectMembershipRole);
if (isCustomRole) {
const projectRole = await projectRoleDAL.findOne({ slug: role, projectId });
if (!projectRole) throw new BadRequestError({ message: "Role not found" });
if (!projectRole) throw new BadRequestError({ message: `Role not found: ${role}` });
return {
permission: buildProjectPermission([
{ role: ProjectMembershipRole.Custom, permissions: projectRole.permissions }