Constructor
# new ForbiddenError(msg) → {void}
This error is thrown when an authenticated user attempts to access a resource or perform an action they don't have permission for
Error thrown when a user is forbidden from accessing a resource
Parameters:
Name | Type | Description |
---|---|---|
msg |
string
|
Error
|
The error message or Error object |
void
Example
```typescript
// Example of throwing a ForbiddenError
if (!user.hasPermission('admin')) {
throw new ForbiddenError('User does not have admin permissions');
}
```