ForbiddenErrorclass
new ForbiddenError(message?: string, options?: RequestErrorOptions)
| Param | Type | |
|---|---|---|
message | string | Optional human-readable description of the privilege failure. |
options | RequestErrorOptions | Optional options — code defaults to 403; caller and contextual fields are applied via setBaseErrorOptions(). |
| Return | |
|---|---|
ForbiddenError | Throw if an operation failed because the user is logged in, but does not have sufficient privileges to access this content. |
Throw if an operation failed because the user is logged in, but does not have sufficient privileges to access this content.
- Sets HTTP status
codeto403.
Examples
throw new ForbiddenError("Admins only");