UNPKG

@thalorlabs/errors

Version:

Enhanced exception handling system for TypeScript applications with comprehensive error classes and debugging capabilities

26 lines (25 loc) 1.02 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.NotFoundError = void 0; const types_1 = require("@thalorlabs/types"); const CustomError_1 = __importDefault(require("./CustomError")); /** * Error for resource not found scenarios. * * Used when requested resources cannot be found in the system. * Provides clear 404 error responses with optional resource context. * * @example * throw new NotFoundError('User not found', 'user-123', 'req-123'); * * throw new NotFoundError('Product not found', null, 'req-456', { category: 'electronics' }); */ class NotFoundError extends CustomError_1.default { constructor(message = 'Not Found', error, requestId, context) { super(types_1.EHttpClientErrorResponse.NOT_FOUND, `${message}${error ? `: ${error}` : ''}`, requestId, context); } } exports.NotFoundError = NotFoundError;