I am having a NestJS backend application.
my-controller.ts
import { Roles } from 'private-npm';
export class myController {
constructor(private readonly service: MyService) { }
---> @ClientRoles({ roles: ['test-role'] })
@Get()
@ApiOperation({ title: 'List users' })
async listUsers(): IUser[] {
return this.service.listUsers();
}
}
@ClientRoles throws Permission not fulfilled, 403 (FORBIDDEN)
error, If a user does not have required roles (e.g. test-role).
The problem is, I can see the error message (ERROR: Permission not fulfilled) in the terminal but I do not get the same error message in my Swagger UI response body.
Instead of an error message, I get the following error message in Swagger UI.
{
"statusCode": 500,
"message": "Internal server error"
}
It's pretty hard to debug also.
Any help is appreciated.