UNPKG

4.9 kBJavaScriptView Raw
1"use strict";
2// tslint:disable:max-classes-per-file
3Object.defineProperty(exports, "__esModule", { value: true });
4class CryptoError extends Error {
5 constructor(message) {
6 super(message);
7 Object.defineProperty(this, "message", {
8 enumerable: false,
9 value: message,
10 });
11 Object.defineProperty(this, "name", {
12 enumerable: false,
13 value: this.constructor.name,
14 });
15 Error.captureStackTrace(this, this.constructor);
16 }
17}
18exports.CryptoError = CryptoError;
19class Bip38CompressionError extends CryptoError {
20 constructor(expected, given) {
21 super(`Expected flag to be ${expected}, but got ${given}.`);
22 }
23}
24exports.Bip38CompressionError = Bip38CompressionError;
25class Bip38LengthError extends CryptoError {
26 constructor(expected, given) {
27 super(`Expected length to be ${expected}, but got ${given}.`);
28 }
29}
30exports.Bip38LengthError = Bip38LengthError;
31class Bip38PrefixError extends CryptoError {
32 constructor(expected, given) {
33 super(`Expected prefix to be ${expected}, but got ${given}.`);
34 }
35}
36exports.Bip38PrefixError = Bip38PrefixError;
37class Bip38TypeError extends CryptoError {
38 constructor(expected, given) {
39 super(`Expected type to be ${expected}, but got ${given}.`);
40 }
41}
42exports.Bip38TypeError = Bip38TypeError;
43class NetworkVersionError extends CryptoError {
44 constructor(expected, given) {
45 super(`Expected version to be ${expected}, but got ${given}.`);
46 }
47}
48exports.NetworkVersionError = NetworkVersionError;
49class NotImplementedError extends CryptoError {
50 constructor() {
51 super(`Feature is not available.`);
52 }
53}
54exports.NotImplementedError = NotImplementedError;
55class PrivateKeyLengthError extends CryptoError {
56 constructor(expected, given) {
57 super(`Expected length to be ${expected}, but got ${given}.`);
58 }
59}
60exports.PrivateKeyLengthError = PrivateKeyLengthError;
61class PublicKeyError extends CryptoError {
62 constructor(given) {
63 super(`Expected ${given} to be a valid public key.`);
64 }
65}
66exports.PublicKeyError = PublicKeyError;
67class TransactionTypeError extends CryptoError {
68 constructor(given) {
69 super(`Type ${given} not supported.`);
70 }
71}
72exports.TransactionTypeError = TransactionTypeError;
73class MalformedTransactionBytesError extends CryptoError {
74 constructor() {
75 super(`Failed to deserialize transaction, because the bytes are malformed.`);
76 }
77}
78exports.MalformedTransactionBytesError = MalformedTransactionBytesError;
79class TransactionSchemaError extends CryptoError {
80 constructor(what) {
81 super(what);
82 }
83}
84exports.TransactionSchemaError = TransactionSchemaError;
85class TransactionVersionError extends CryptoError {
86 constructor(given) {
87 super(`Version ${given} not supported.`);
88 }
89}
90exports.TransactionVersionError = TransactionVersionError;
91class UnkownTransactionError extends CryptoError {
92 constructor(given) {
93 super(`Transaction type ${given} is not registered.`);
94 }
95}
96exports.UnkownTransactionError = UnkownTransactionError;
97class TransactionAlreadyRegisteredError extends CryptoError {
98 constructor(name) {
99 super(`Transaction type ${name} is already registered.`);
100 }
101}
102exports.TransactionAlreadyRegisteredError = TransactionAlreadyRegisteredError;
103class TransactionTypeInvalidRangeError extends CryptoError {
104 constructor(given) {
105 super(`Custom transaction type must be in the range 100-255 (${given}).`);
106 }
107}
108exports.TransactionTypeInvalidRangeError = TransactionTypeInvalidRangeError;
109class MissingMilestoneFeeError extends CryptoError {
110 constructor(name) {
111 super(`Missing milestone fee for '${name}'.`);
112 }
113}
114exports.MissingMilestoneFeeError = MissingMilestoneFeeError;
115class MaximumPaymentCountExceededError extends CryptoError {
116 constructor(given) {
117 super(`Expected a maximum of 2258 payments, but got ${given}.`);
118 }
119}
120exports.MaximumPaymentCountExceededError = MaximumPaymentCountExceededError;
121class MissingTransactionSignatureError extends CryptoError {
122 constructor() {
123 super(`Expected the transaction to be signed.`);
124 }
125}
126exports.MissingTransactionSignatureError = MissingTransactionSignatureError;
127class BlockSchemaError extends CryptoError {
128 constructor(what) {
129 super(what);
130 }
131}
132exports.BlockSchemaError = BlockSchemaError;
133class PreviousBlockIdFormatError extends CryptoError {
134 constructor(thisBlockHeight, previousBlockId) {
135 super(`The config denotes that the block at height ${thisBlockHeight - 1} ` +
136 `must use full SHA256 block id, but the next block (at ${thisBlockHeight}) ` +
137 `contains previous block id "${previousBlockId}"`);
138 }
139}
140exports.PreviousBlockIdFormatError = PreviousBlockIdFormatError;
141//# sourceMappingURL=errors.js.map
\No newline at end of file