UnauthorizedErrorclass

new UnauthorizedError(message?: string, options?: RequestErrorOptions)
ParamType
messagestring
Optional human-readable description of the authorization failure.
optionsRequestErrorOptions
Optional options — code defaults to 401; caller and contextual fields are applied via setBaseErrorOptions().
Return
UnauthorizedError
Throw if an operation failed because the user is not logged in, or the login information is not well-formed.

Throw if an operation failed because the user is not logged in, or the login information is not well-formed.

  • Sets HTTP status code to 401.

Examples

throw new UnauthorizedError("Please log in");