misc: finalized error message

This commit is contained in:
Sheen Capadngan
2025-03-21 18:48:02 +08:00
parent cca7b68dd0
commit 6f9a66a0d7
8 changed files with 13 additions and 11 deletions
@@ -100,7 +100,7 @@ export const groupServiceFactory = ({
throw new ForbiddenRequestError({
name: "PermissionBoundaryError",
message: constructPermissionErrorMessage(
"Failed to create a more privileged group",
"Failed to create group",
membership.shouldUseNewPrivilegeSystem,
OrgPermissionGroupActions.ManagePrivileges,
OrgPermissionSubjects.Groups
@@ -185,7 +185,7 @@ export const groupServiceFactory = ({
throw new ForbiddenRequestError({
name: "PermissionBoundaryError",
message: constructPermissionErrorMessage(
"Failed to update a more privileged group",
"Failed to update group",
membership.shouldUseNewPrivilegeSystem,
OrgPermissionGroupActions.ManagePrivileges,
OrgPermissionSubjects.Groups
@@ -188,7 +188,9 @@ const constructPermissionErrorMessage = (
opSubject: OrgPermissionSet[1] | ProjectPermissionSet[1]
) => {
return `${baseMessage}${
shouldUseNewPrivilegeSystem ? `. Missing permission ${opAction as string} on ${opSubject as string}` : ""
shouldUseNewPrivilegeSystem
? `. Missing permission ${opAction as string} on ${opSubject as string}`
: ". Privilege level is not high enough to perform this action"
}`;
};