UnauthorizedErrorclass

new UnauthorizedError(message?: string, options?: RequestErrorOptions)
ParamType
messagestring
Optional human-readable description of the authorization failure.
optionsRequestErrorOptions
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");