fix: error improvements

This commit is contained in:
Daniel Hougaard
2024-09-27 21:22:14 +04:00
parent d430293c66
commit d5a4eb609a
9 changed files with 79 additions and 68 deletions
+4 -2
View File
@@ -892,7 +892,7 @@ export const orgServiceFactory = ({
const membership = await orgMembershipDAL.findOrgMembershipById(membershipId);
if (!membership) {
throw new NotFoundError({ message: "Failed to find organization membership" });
throw new NotFoundError({ message: "Organization membership not found" });
}
if (membership.orgId !== orgId) {
throw new ForbiddenRequestError({ message: "Membership does not belong to organization" });
@@ -937,7 +937,9 @@ export const orgServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Read, OrgPermissionSubjects.Member);
const membership = await orgMembershipDAL.findOrgMembershipById(orgMembershipId);
if (!membership) throw new NotFoundError({ message: "Failed to find organization membership" });
if (!membership) {
throw new NotFoundError({ message: "Organization membership not found" });
}
if (membership.orgId !== orgId) throw new NotFoundError({ message: "Failed to find organization membership" });
const projectMemberships = await projectMembershipDAL.findProjectMembershipsByUserId(orgId, membership.user.id);