ForbiddenErrorclass

new ForbiddenError(message?: string, options?: RequestErrorOptions)
ParamType
messagestring
Optional human-readable description of the privilege failure.
optionsRequestErrorOptions
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 code to 403.

Examples

throw new ForbiddenError("Admins only");