UNPKG

jsm-exceptions

Version:

A comprehensive TypeScript exception library with HTTP status code support, detailed JSDoc documentation, and backward compatibility. Provides structured error handling for web applications and APIs.

29 lines (28 loc) 979 B
import BaseException from "./base.exception"; /** * @fileoverview Unauthorized exception (HTTP 401) * @author dr. Salmi <reevosolutions@gmail.com> */ /** * Exception thrown when authentication is required but not provided or invalid. * Corresponds to HTTP 401 Unauthorized status code. * * @class UnauthorizedException * @extends {BaseException} * @example * ```typescript * throw new UnauthorizedException('Invalid credentials'); * throw new UnauthorizedException('Token expired', { tokenType: 'access' }); * ``` */ declare class UnauthorizedException extends BaseException { /** * Creates an instance of UnauthorizedException. * * @param {string} [message='Unauthorized'] - The error message * @param {Record<string, any>} [context] - Additional context about the authorization failure * @memberof UnauthorizedException */ constructor(message?: string, context?: Record<string, any>); } export default UnauthorizedException;