UnauthorizedException (exceptions/unauthorized.exception.ts)

nest · packages/common/exceptions/unauthorized.exception.ts · typescript · MIT
integration

Provides a NestJS UnauthorizedException class for HTTP 401 errors, extending HttpException.

// Source: https://github.com/nestjs/nest | License: MIT | Copyright 2017-present Kamil Mysliwiec <https://kamilmysliwiec.com>
// Provided via justclaw.it.com; keep this notice with the code.
import { HttpStatus } from '../enums/http-status.enum.js';
import { HttpException, HttpExceptionOptions } from './http.exception.js';

/**
 * Defines an HTTP exception for *Unauthorized* type errors.
 *
 * @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
 *
 * @publicApi
 */
export class UnauthorizedException extends HttpException {
  /**
   * Instantiate an `UnauthorizedException` Exception.
   *
   * @example
   * `throw new UnauthorizedException()`
   *
   * @usageNotes
   * The HTTP response status code will be 401.
   * - The `objectOrError` argu

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key