@duongtrungnguyen/nestro
Version:
Service registry for Nest JS
56 lines • 2.09 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var errors_exports = {};
__export(errors_exports, {
ProxyError: () => ProxyError,
ProxyErrorType: () => ProxyErrorType
});
module.exports = __toCommonJS(errors_exports);
var import_common = require("@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 = import_common.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
});
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ProxyError,
ProxyErrorType
});
//# sourceMappingURL=errors.js.map