UNPKG

@thalorlabs/errors

Version:

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

25 lines (24 loc) 1.01 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GatewayTimeoutError = void 0; const CustomError_1 = __importDefault(require("./CustomError")); /** * Error for gateway timeout scenarios. * * Used when upstream services fail to respond within the timeout period. * Provides clear 504 error responses with optional timeout context. * * @example * throw new GatewayTimeoutError('Upstream service timeout', 'service-unavailable', 'req-123'); * * throw new GatewayTimeoutError('Gateway timeout', null, 'req-456', { timeoutMs: 5000, service: 'payment-api' }); */ class GatewayTimeoutError extends CustomError_1.default { constructor(message = 'Gateway Timeout', error, requestId, context) { super(504, `${message}${error ? `: ${error}` : ''}`, requestId, context); } } exports.GatewayTimeoutError = GatewayTimeoutError;