UnauthorizedErrorclass
new UnauthorizedError(message?: string, options?: RequestErrorOptions)
| Param | Type | |
|---|---|---|
message | string | Optional human-readable description of the authorization failure. |
options | RequestErrorOptions | 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
codeto401.
Examples
throw new UnauthorizedError("Please log in");