UNPKG

@sangaman/xud

Version:
39 lines 1.69 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const errorCodesPrefix_1 = __importDefault(require("../constants/errorCodesPrefix")); const codesPrefix = errorCodesPrefix_1.default.P2P; const errorCodes = { NODE_ALREADY_CONNECTED: codesPrefix.concat('.1'), NOT_CONNECTED: codesPrefix.concat('.2'), UNEXPECTED_NODE_PUB_KEY: codesPrefix.concat('.3'), ATTEMPTED_CONNECTION_TO_SELF: codesPrefix.concat('.4'), EXTERNAL_IP_UNRETRIEVABLE: codesPrefix.concat('.5'), }; exports.errorCodes = errorCodes; const errors = { NODE_ALREADY_CONNECTED: (nodePubKey, address) => ({ message: `Node ${nodePubKey} at (${address}) already connected`, code: errorCodes.NODE_ALREADY_CONNECTED, }), NOT_CONNECTED: (nodePubKey) => ({ message: `Node (${nodePubKey}) is not connected`, code: errorCodes.NOT_CONNECTED, }), UNEXPECTED_NODE_PUB_KEY: (nodePubKey, expectedNodePubKey, address) => ({ message: `Node at ${address} sent pub key ${nodePubKey}, expected ${expectedNodePubKey}`, code: errorCodes.UNEXPECTED_NODE_PUB_KEY, }), ATTEMPTED_CONNECTION_TO_SELF: { message: 'Cannot attempt connection to self', code: errorCodes.ATTEMPTED_CONNECTION_TO_SELF, }, EXTERNAL_IP_UNRETRIEVABLE: (err) => ({ message: `could not retrieve external IP: ${err.message}`, code: errorCodes.EXTERNAL_IP_UNRETRIEVABLE, }), }; exports.default = errors; //# sourceMappingURL=errors.js.map