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.
32 lines (31 loc) • 985 B
TypeScript
import BaseException from "./base.exception";
/**
* @fileoverview Forbidden exception (HTTP 403)
* @author dr. Salmi <reevosolutions@gmail.com>
*/
/**
* Exception thrown when the client does not have permission to access a resource.
* Corresponds to HTTP 403 Forbidden status code.
*
* @class ForbiddenException
* @extends {BaseException}
* @example
* ```typescript
* throw new ForbiddenException('Access denied');
* throw new ForbiddenException('Insufficient permissions', {
* requiredRole: 'admin',
* userRole: 'user'
* });
* ```
*/
declare class ForbiddenException extends BaseException {
/**
* Creates an instance of ForbiddenException.
*
* @param {string} [message='Forbidden'] - The error message
* @param {Record<string, any>} [context] - Additional context about the permission denial
* @memberof ForbiddenException
*/
constructor(message?: string, context?: Record<string, any>);
}
export default ForbiddenException;