@node-dlc/wire
Version:
Lightning Network Wire Protocol
41 lines • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WireError = exports.WireErrorCode = void 0;
var WireErrorCode;
(function (WireErrorCode) {
WireErrorCode[WireErrorCode["nodeAnnSigFailed"] = 1] = "nodeAnnSigFailed";
WireErrorCode[WireErrorCode["chanAnnSigFailed"] = 2] = "chanAnnSigFailed";
WireErrorCode[WireErrorCode["chanUpdSigFailed"] = 3] = "chanUpdSigFailed";
WireErrorCode[WireErrorCode["chanBadBlockHash"] = 4] = "chanBadBlockHash";
WireErrorCode[WireErrorCode["chanBadBlock"] = 5] = "chanBadBlock";
WireErrorCode[WireErrorCode["chanAnnBadTx"] = 6] = "chanAnnBadTx";
WireErrorCode[WireErrorCode["chanUtxoSpent"] = 7] = "chanUtxoSpent";
WireErrorCode[WireErrorCode["chanBadScript"] = 8] = "chanBadScript";
WireErrorCode[WireErrorCode["gossipManagerNotStarted"] = 101] = "gossipManagerNotStarted";
})(WireErrorCode = exports.WireErrorCode || (exports.WireErrorCode = {}));
const errorCodeStrings = {
1: 'node_ann_sig_failed',
2: 'chan_ann_sig_failed',
3: 'chan_upd_sig_failed',
4: 'chan_bad_block_hash',
5: 'chan_bad_block',
6: 'chan_bad_tx',
7: 'chan_utxo_spent',
8: 'chan_bad_script',
101: 'gossip_manager_not_started',
};
/**
* Creates an error for a wire operation and captures relevant that
* caused the error to be emitted or thrown.
*/
class WireError extends Error {
constructor(code, data) {
const msg = `${errorCodeStrings[code]}`;
super(msg);
this.area = 'wire';
this.code = code;
this.data = data;
}
}
exports.WireError = WireError;
//# sourceMappingURL=WireError.js.map