UNPKG

@mojaloop/inter-scheme-proxy-cache-lib

Version:

Common component, that provides scheme proxy caching mapping (ISPC)

63 lines (60 loc) 2.13 kB
"use strict"; 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); // src/lib/errors.ts var errors_exports = {}; __export(errors_exports, { ProxyCacheError: () => ProxyCacheError, ValidationError: () => ValidationError }); module.exports = __toCommonJS(errors_exports); // src/constants.ts var STORAGE_TYPES = { redis: "redis", redisCluster: "redis-cluster", mysql: "mysql" }; var storageTypeValues = Object.values(STORAGE_TYPES); var ERROR_MESSAGES = { unsupportedProxyCacheType: `Unsupported proxyCache type [possible values: ${storageTypeValues.join(", ")}]`, invalidFormat: "Invalid format" // add all needed error messages }; // src/lib/errors.ts var ProxyCacheError = class _ProxyCacheError extends Error { constructor(message) { super(message); Error.captureStackTrace(this, this.constructor); this.name = this.constructor.name; } static unsupportedProxyCacheType() { return new _ProxyCacheError(ERROR_MESSAGES.unsupportedProxyCacheType); } }; var ValidationError = class _ValidationError extends ProxyCacheError { static invalidFormat(details) { const erMessage = `${ERROR_MESSAGES.invalidFormat}${details ? ` - ${details}` : ""}`; return new _ValidationError(erMessage); } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ProxyCacheError, ValidationError }); //# sourceMappingURL=errors.js.map