@dev-abhi/errorify
Version:
A utility package for simplified error handling and management in Node.js applications.
42 lines (41 loc) • 2.07 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpVersionNotSupportedError = exports.GatewayTimeoutError = exports.ServiceUnavailableError = exports.BadGatewayError = exports.NotImplementedError = exports.InternalServerError = void 0;
const errorCodes_1 = require("../../utils/errorCodes");
const CustomError_1 = require("../CustomError");
class InternalServerError extends CustomError_1.CustomError {
constructor(message = "Internal Server Error", details = {}) {
super(message, 500, errorCodes_1.ErrorCodes.INTERNAL_SERVER_ERROR, details);
}
}
exports.InternalServerError = InternalServerError;
class NotImplementedError extends CustomError_1.CustomError {
constructor(message = "Not Implemented Error", details = {}) {
super(message, 501, errorCodes_1.ErrorCodes.NOT_IMPLEMENTED_ERROR, details);
}
}
exports.NotImplementedError = NotImplementedError;
class BadGatewayError extends CustomError_1.CustomError {
constructor(message = "Bad Gateway Error", details = {}) {
super(message, 502, errorCodes_1.ErrorCodes.BAD_GATEWAY_ERROR, details);
}
}
exports.BadGatewayError = BadGatewayError;
class ServiceUnavailableError extends CustomError_1.CustomError {
constructor(message = "Service Unavailable Error", details = {}) {
super(message, 503, errorCodes_1.ErrorCodes.SERVICE_UNAVAILABLE_ERROR, details);
}
}
exports.ServiceUnavailableError = ServiceUnavailableError;
class GatewayTimeoutError extends CustomError_1.CustomError {
constructor(message = "Gateway Timeout Error", details = {}) {
super(message, 504, errorCodes_1.ErrorCodes.GATEWAY_TIMEOUT_ERROR, details);
}
}
exports.GatewayTimeoutError = GatewayTimeoutError;
class HttpVersionNotSupportedError extends CustomError_1.CustomError {
constructor(message = "HTTP Version Not Supported Error", details = {}) {
super(message, 505, errorCodes_1.ErrorCodes.HTTP_VERSION_NOT_SUPPORTED_ERROR, details);
}
}
exports.HttpVersionNotSupportedError = HttpVersionNotSupportedError;
;