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.
38 lines (37 loc) • 1.36 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const base_exception_1 = __importDefault(require("./base.exception"));
/**
 * @fileoverview No Content exception (HTTP 204)
 * @author dr. Salmi <reevosolutions@gmail.com>
 * @since 21-10-2023 11:38:33
 */
/**
 * Exception thrown when the request is valid but the server has nothing to send back.
 * Corresponds to HTTP 204 No Content status code.
 * Used when an event is received and the service has nothing to do with it.
 *
 * @class NoContentException
 * @extends {BaseException}
 * @example
 * ```typescript
 * throw new NoContentException('No data to return');
 * throw new NoContentException('Event processed but no response needed', { eventType: 'ping' });
 * ```
 */
class NoContentException extends base_exception_1.default {
    /**
     * Creates an instance of NoContentException.
     *
     * @param {string} [message='No Content'] - The error message
     * @param {Record<string, any>} [context] - Additional context about why there's no content
     * @memberof NoContentException
     */
    constructor(message = 'No Content', context) {
        super(message, 204, context);
    }
}
exports.default = NoContentException;