UNPKG

@duongtrungnguyen/nestro

Version:
32 lines 1.04 kB
import { HttpStatus } from "@nestjs/common"; var ProxyErrorType = /* @__PURE__ */ ((ProxyErrorType2) => { ProxyErrorType2["CONNECTION_FAILED"] = "CONNECTION_FAILED"; ProxyErrorType2["TIMEOUT"] = "TIMEOUT"; ProxyErrorType2["TARGET_NOT_FOUND"] = "TARGET_NOT_FOUND"; ProxyErrorType2["INVALID_RESPONSE"] = "INVALID_RESPONSE"; ProxyErrorType2["NETWORK_ERROR"] = "NETWORK_ERROR"; ProxyErrorType2["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR"; ProxyErrorType2["UNKNOWN"] = "UNKNOWN"; return ProxyErrorType2; })(ProxyErrorType || {}); class ProxyError extends Error { constructor(message, type, statusCode = HttpStatus.SERVICE_UNAVAILABLE) { super(message); this.type = type; this.statusCode = statusCode; this.timestamp = /* @__PURE__ */ new Date(); this.name = "ProxyError"; } toJson() { return JSON.stringify({ message: this.message, timestamp: this.timestamp, statusCode: this.statusCode }); } } export { ProxyError, ProxyErrorType }; //# sourceMappingURL=errors.js.map