add userFriendly messages to PermissionsException (#13659)

/closes #13580

<img width="1186" height="754" alt="image"
src="https://github.com/user-attachments/assets/d5be9e3a-2748-4ad0-b29b-98038cbeeb6a"
/>
This commit is contained in:
neo773
2025-08-06 02:11:51 +05:30
committed by GitHub
parent 22eedb0281
commit a804d65210
11 changed files with 148 additions and 0 deletions
@@ -195,6 +195,10 @@ export class UserRoleService {
throw new PermissionsException(
PermissionsExceptionMessage.NO_ROLE_FOUND_FOR_USER_WORKSPACE,
PermissionsExceptionCode.NO_ROLE_FOUND_FOR_USER_WORKSPACE,
{
userFriendlyMessage:
'Your role in this workspace could not be found. Please contact your workspace administrator.',
},
);
}
@@ -227,6 +231,10 @@ export class UserRoleService {
throw new PermissionsException(
'User workspace not found',
PermissionsExceptionCode.USER_WORKSPACE_NOT_FOUND,
{
userFriendlyMessage:
'Your workspace membership could not be found. You may no longer have access to this workspace.',
},
);
}
@@ -240,6 +248,10 @@ export class UserRoleService {
throw new PermissionsException(
'Role not found',
PermissionsExceptionCode.ROLE_NOT_FOUND,
{
userFriendlyMessage:
'The role you are trying to assign could not be found. It may have been deleted.',
},
);
}
@@ -280,6 +292,10 @@ export class UserRoleService {
throw new PermissionsException(
PermissionsExceptionMessage.CANNOT_UNASSIGN_LAST_ADMIN,
PermissionsExceptionCode.CANNOT_UNASSIGN_LAST_ADMIN,
{
userFriendlyMessage:
'You cannot remove the admin role from the last administrator. Please assign another administrator first.',
},
);
}
}