Skip to content

Commit 94fee67

Browse files
authored
Convert all errors in @solana/rpc-types to coded exceptions (#2226)
Addresses #2118.
1 parent 613053d commit 94fee67

15 files changed

+192
-61
lines changed

packages/errors/src/codes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ export const SOLANA_ERROR__CODECS_FIXED_NULLABLE_WITH_VARIABLE_SIZE_PREFIX = 44
5151
export const SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE = 45 as const;
5252
export const SOLANA_ERROR__CODECS_NUMBER_OUT_OF_RANGE = 46 as const;
5353
export const SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE = 47 as const;
54+
export const SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE = 48 as const;
55+
export const SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE = 49 as const;
56+
export const SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE = 50 as const;
57+
export const SOLANA_ERROR__MALFORMED_BIGINT_STRING = 51 as const;
58+
export const SOLANA_ERROR__MALFORMED_NUMBER_STRING = 52 as const;
59+
export const SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE = 53 as const;
5460
export const SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_ACCOUNTS = 70 as const;
5561
export const SOLANA_ERROR__EXPECTED_INSTRUCTION_TO_HAVE_DATA = 71 as const;
5662
// Reserve error codes starting with [4615000-4615999] for the Rust enum `InstructionError`
@@ -216,6 +222,12 @@ export type SolanaErrorCode =
216222
| typeof SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE
217223
| typeof SOLANA_ERROR__COULD_NOT_FIND_VIABLE_PDA_BUMP_SEED
218224
| typeof SOLANA_ERROR__PROGRAM_ADDRESS_ENDS_WITH_PDA_MARKER
225+
| typeof SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE
226+
| typeof SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE
227+
| typeof SOLANA_ERROR__MALFORMED_BIGINT_STRING
228+
| typeof SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE
229+
| typeof SOLANA_ERROR__MALFORMED_NUMBER_STRING
230+
| typeof SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE
219231
| typeof SOLANA_ERROR__SUBTLE_CRYPTO_MISSING
220232
| typeof SOLANA_ERROR__SUBTLE_CRYPTO_DIGEST_MISSING
221233
| typeof SOLANA_ERROR__SUBTLE_CRYPTO_ED25519_ALGORITHM_MISSING

packages/errors/src/context.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {
33
SOLANA_ERROR__ADDRESS_BYTE_LENGTH_OUT_OF_RANGE,
44
SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE,
55
SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED,
6+
SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE,
7+
SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE,
68
SOLANA_ERROR__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY,
79
SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE,
810
SOLANA_ERROR__CODECS_ENUM_DISCRIMINATOR_OUT_OF_RANGE,
@@ -74,6 +76,8 @@ import {
7476
SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_PROGRAM_ID,
7577
SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR,
7678
SOLANA_ERROR__INVALID_KEYPAIR_BYTES,
79+
SOLANA_ERROR__MALFORMED_BIGINT_STRING,
80+
SOLANA_ERROR__MALFORMED_NUMBER_STRING,
7781
SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED,
7882
SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED,
7983
SOLANA_ERROR__MULTIPLE_ACCOUNTS_NOT_FOUND,
@@ -92,6 +96,7 @@ import {
9296
SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_PARTIAL_SIGNER,
9397
SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SENDING_SIGNER,
9498
SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SIGNER,
99+
SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE,
95100
SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION,
96101
SOLANA_ERROR__TRANSACTION_ERROR_INSUFFICIENT_FUNDS_FOR_RENT,
97102
SOLANA_ERROR__TRANSACTION_ERROR_PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED,
@@ -187,6 +192,12 @@ export type SolanaErrorContext = DefaultUnspecifiedErrorContextToUndefined<
187192
[SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE]: {
188193
actualLength: number;
189194
};
195+
[SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE]: {
196+
actualLength: number;
197+
};
198+
[SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]: {
199+
actualLength: number;
200+
};
190201
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: {
191202
currentBlockHeight: bigint;
192203
lastValidBlockHeight: bigint;
@@ -263,6 +274,9 @@ export type SolanaErrorContext = DefaultUnspecifiedErrorContextToUndefined<
263274
[SOLANA_ERROR__INVALID_KEYPAIR_BYTES]: {
264275
byteLength: number;
265276
};
277+
[SOLANA_ERROR__MALFORMED_BIGINT_STRING]: {
278+
value: string;
279+
};
266280
[SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]: {
267281
actual: number;
268282
maxSeeds: number;
@@ -288,6 +302,9 @@ export type SolanaErrorContext = DefaultUnspecifiedErrorContextToUndefined<
288302
[SOLANA_ERROR__NOT_ALL_ACCOUNTS_DECODED]: {
289303
addresses: string[];
290304
};
305+
[SOLANA_ERROR__MALFORMED_NUMBER_STRING]: {
306+
value: string;
307+
};
291308
[SOLANA_ERROR__PROGRAM_DERIVED_ADDRESS_BUMP_SEED_OUT_OF_RANGE]: {
292309
bump: number;
293310
};
@@ -326,6 +343,9 @@ export type SolanaErrorContext = DefaultUnspecifiedErrorContextToUndefined<
326343
[SOLANA_ERROR__SIGNER_EXPECTED_TRANSACTION_SIGNER]: {
327344
address: string;
328345
};
346+
[SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]: {
347+
value: number;
348+
};
329349
[SOLANA_ERROR__TRANSACTION_ERROR_DUPLICATE_INSTRUCTION]: {
330350
index: number;
331351
};

packages/errors/src/messages.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {
33
SOLANA_ERROR__ADDRESS_BYTE_LENGTH_OUT_OF_RANGE,
44
SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE,
55
SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED,
6+
SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE,
7+
SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE,
68
SOLANA_ERROR__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY,
79
SOLANA_ERROR__CODECS_CANNOT_REVERSE_CODEC_OF_VARIABLE_SIZE,
810
SOLANA_ERROR__CODECS_CODEC_REQUIRES_FIXED_SIZE,
@@ -82,6 +84,9 @@ import {
8284
SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR,
8385
SOLANA_ERROR__INVALID_KEYPAIR_BYTES,
8486
SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE,
87+
SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE,
88+
SOLANA_ERROR__MALFORMED_BIGINT_STRING,
89+
SOLANA_ERROR__MALFORMED_NUMBER_STRING,
8590
SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS,
8691
SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED,
8792
SOLANA_ERROR__MAX_PDA_SEED_LENGTH_EXCEEDED,
@@ -112,6 +117,7 @@ import {
112117
SOLANA_ERROR__SUBTLE_CRYPTO_MISSING,
113118
SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING,
114119
SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING,
120+
SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE,
115121
SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_BORROW_OUTSTANDING,
116122
SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_IN_USE,
117123
SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_LOADED_TWICE,
@@ -184,6 +190,10 @@ export const SolanaErrorMessages: Readonly<{
184190
'Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.',
185191
[SOLANA_ERROR__ADDRESS_STRING_LENGTH_OUT_OF_RANGE]:
186192
'Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.',
193+
[SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE]:
194+
'Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.',
195+
[SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]:
196+
'Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.',
187197
[SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]:
188198
'The network has progressed past the last block for which this transaction could have been committed.',
189199
[SOLANA_ERROR__CODECS_CANNOT_DECODE_EMPTY_BYTE_ARRAY]: 'Codec [$codecDescription] cannot decode empty byte arrays.',
@@ -292,6 +302,9 @@ export const SolanaErrorMessages: Readonly<{
292302
[SOLANA_ERROR__INSTRUCTION_ERROR_UNSUPPORTED_SYSVAR]: 'Unsupported sysvar',
293303
[SOLANA_ERROR__INVALID_KEYPAIR_BYTES]: 'Key pair bytes must be of length 64, got $byteLength.',
294304
[SOLANA_ERROR__INVALID_SEEDS_POINT_ON_CURVE]: 'Invalid seeds; point must fall off the Ed25519 curve.',
305+
[SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE]: 'Lamports value must be in the range [0, 2e64-1]',
306+
[SOLANA_ERROR__MALFORMED_BIGINT_STRING]: '`$value` cannot be parsed as a `BigInt`',
307+
[SOLANA_ERROR__MALFORMED_NUMBER_STRING]: '`$value` cannot be parsed as a `Number`',
295308
[SOLANA_ERROR__MALFORMED_PROGRAM_DERIVED_ADDRESS]:
296309
'Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].',
297310
[SOLANA_ERROR__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]:
@@ -351,6 +364,7 @@ export const SolanaErrorMessages: Readonly<{
351364
'here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.',
352365
[SOLANA_ERROR__SUBTLE_CRYPTO_SIGN_FUNCTION_MISSING]: 'No signing implementation could be found.',
353366
[SOLANA_ERROR__SUBTLE_CRYPTO_VERIFY_FUNCTION_MISSING]: 'No key export implementation could be found.',
367+
[SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]: 'Timestamp value must be in the range [-8.64e15, 8.64e15]. `$value` given',
354368
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_BORROW_OUTSTANDING]:
355369
'Transaction processing left an account with an outstanding borrowed reference',
356370
[SOLANA_ERROR__TRANSACTION_ERROR_ACCOUNT_IN_USE]: 'Account in use',

packages/rpc-types/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
],
6565
"dependencies": {
6666
"@solana/addresses": "workspace:*",
67-
"@solana/codecs-strings": "workspace:*"
67+
"@solana/codecs-strings": "workspace:*",
68+
"@solana/errors": "workspace:*"
6869
},
6970
"devDependencies": {
7071
"@solana/build-scripts": "workspace:*",

packages/rpc-types/src/__tests__/blockhash-test.ts

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import type { VariableSizeEncoder } from '@solana/codecs-core';
22
import { getBase58Encoder } from '@solana/codecs-strings';
3+
import {
4+
SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE,
5+
SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE,
6+
SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE,
7+
SolanaError,
8+
} from '@solana/errors';
39

410
jest.mock('@solana/codecs-strings', () => ({
511
...jest.requireActual('@solana/codecs-strings'),
@@ -30,17 +36,38 @@ describe('assertIsBlockhash()', () => {
3036
});
3137

3238
it('throws when supplied a non-base58 string', () => {
39+
const badBlockhash = 'not-a-base-58-encoded-string-but-nice-try';
3340
expect(() => {
34-
assertIsBlockhash('not-a-base-58-encoded-string');
35-
}).toThrow();
41+
assertIsBlockhash(badBlockhash);
42+
}).toThrow(
43+
new SolanaError(SOLANA_ERROR__CODECS_INVALID_STRING_FOR_BASE, {
44+
alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',
45+
base: 58,
46+
value: badBlockhash,
47+
}),
48+
);
3649
});
37-
it('throws when the decoded byte array has a length other than 32 bytes', () => {
50+
it.each([31, 45])('throws when the encoded string is of length %s', actualLength => {
51+
const badBlockhash = '1'.repeat(actualLength);
3852
expect(() => {
39-
assertIsBlockhash(
40-
// 31 bytes [128, ..., 128]
41-
'2xea9jWJ9eca3dFiefTeSPP85c6qXqunCqL2h2JNffM',
42-
);
43-
}).toThrow();
53+
assertIsBlockhash(badBlockhash);
54+
}).toThrow(
55+
new SolanaError(SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, {
56+
actualLength,
57+
}),
58+
);
59+
});
60+
it.each([
61+
[31, 'tVojvhToWjQ8Xvo4UPx2Xz9eRy7auyYMmZBjc2XfN'],
62+
[33, 'JJEfe6DcPM2ziB2vfUWDV6aHVerXRGkv3TcyvJUNGHZz'],
63+
])('throws when the decoded byte array has a length of %s bytes', (actualLength, badBlockhash) => {
64+
expect(() => {
65+
assertIsBlockhash(badBlockhash);
66+
}).toThrow(
67+
new SolanaError(SOLANA_ERROR__BLOCKHASH_BYTE_LENGTH_OUT_OF_RANGE, {
68+
actualLength,
69+
}),
70+
);
4471
});
4572
it('does not throw when supplied a base-58 encoded hash', () => {
4673
expect(() => {

packages/rpc-types/src/__tests__/coercions-test.ts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
import {
2+
SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE,
3+
SOLANA_ERROR__MALFORMED_BIGINT_STRING,
4+
SOLANA_ERROR__MALFORMED_NUMBER_STRING,
5+
SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE,
6+
SolanaError,
7+
} from '@solana/errors';
8+
19
import { lamports, LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports';
210
import { StringifiedBigInt, stringifiedBigInt } from '../stringified-bigint';
311
import { StringifiedNumber, stringifiedNumber } from '../stringified-number';
@@ -12,7 +20,7 @@ describe('coercions', () => {
1220
});
1321
it('throws on invalid `LamportsUnsafeBeyond2Pow53Minus1`', () => {
1422
const thisThrows = () => lamports(-5n);
15-
expect(thisThrows).toThrow('Input for 64-bit unsigned integer cannot be negative');
23+
expect(thisThrows).toThrow(new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE));
1624
});
1725
});
1826
describe('stringifiedBigInt', () => {
@@ -23,7 +31,11 @@ describe('coercions', () => {
2331
});
2432
it('throws on invalid `StringifiedBigInt`', () => {
2533
const thisThrows = () => stringifiedBigInt('test');
26-
expect(thisThrows).toThrow('`test` cannot be parsed as a BigInt');
34+
expect(thisThrows).toThrow(
35+
new SolanaError(SOLANA_ERROR__MALFORMED_BIGINT_STRING, {
36+
value: 'test',
37+
}),
38+
);
2739
});
2840
});
2941
describe('stringifiedNumber', () => {
@@ -34,7 +46,11 @@ describe('coercions', () => {
3446
});
3547
it('throws on invalid `StringifiedNumber`', () => {
3648
const thisThrows = () => stringifiedNumber('test');
37-
expect(thisThrows).toThrow('`test` cannot be parsed as a Number');
49+
expect(thisThrows).toThrow(
50+
new SolanaError(SOLANA_ERROR__MALFORMED_NUMBER_STRING, {
51+
value: 'test',
52+
}),
53+
);
3854
});
3955
});
4056
describe('unixTimestamp', () => {
@@ -43,9 +59,13 @@ describe('coercions', () => {
4359
const coerced = unixTimestamp(1234);
4460
expect(coerced).toBe(raw);
4561
});
46-
it('throws on invalid `UnixTimestamp`', () => {
62+
it('throws on an out-of-range `UnixTimestamp`', () => {
4763
const thisThrows = () => unixTimestamp(8.75e15);
48-
expect(thisThrows).toThrow('`8750000000000000` is not a timestamp');
64+
expect(thisThrows).toThrow(
65+
new SolanaError(SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE, {
66+
value: 8.75e15,
67+
}),
68+
);
4969
});
5070
});
5171
});

packages/rpc-types/src/__tests__/lamports-test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
import { SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE, SolanaError } from '@solana/errors';
2+
13
import { assertIsLamports } from '../lamports';
24

35
describe('assertIsLamports()', () => {
46
it('throws when supplied a negative number', () => {
57
expect(() => {
68
assertIsLamports(-1n);
7-
}).toThrow();
9+
}).toThrow(new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE));
810
expect(() => {
911
assertIsLamports(-1000n);
10-
}).toThrow();
12+
}).toThrow(new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE));
1113
});
1214
it('throws when supplied a too large number', () => {
1315
expect(() => {
1416
assertIsLamports(2n ** 64n);
15-
}).toThrow();
17+
}).toThrow(new SolanaError(SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE));
1618
});
1719
it('does not throw when supplied zero lamports', () => {
1820
expect(() => {

packages/rpc-types/src/__tests__/stringified-bigint-test.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
1+
import { SOLANA_ERROR__MALFORMED_BIGINT_STRING, SolanaError } from '@solana/errors';
2+
13
import { assertIsStringifiedBigInt } from '../stringified-bigint';
24

35
describe('assertIsStringifiedBigInt()', () => {
46
it("throws when supplied a string that can't parse as a number", () => {
57
expect(() => {
68
assertIsStringifiedBigInt('abc');
7-
}).toThrow();
9+
}).toThrow(
10+
new SolanaError(SOLANA_ERROR__MALFORMED_BIGINT_STRING, {
11+
value: 'abc',
12+
}),
13+
);
814
expect(() => {
915
assertIsStringifiedBigInt('123a');
10-
}).toThrow();
16+
}).toThrow(
17+
new SolanaError(SOLANA_ERROR__MALFORMED_BIGINT_STRING, {
18+
value: '123a',
19+
}),
20+
);
1121
});
1222
it("throws when supplied a string that can't parse as an integer", () => {
1323
expect(() => {
1424
assertIsStringifiedBigInt('123.0');
15-
}).toThrow();
25+
}).toThrow(
26+
new SolanaError(SOLANA_ERROR__MALFORMED_BIGINT_STRING, {
27+
value: '123.0',
28+
}),
29+
);
1630
expect(() => {
1731
assertIsStringifiedBigInt('123.5');
18-
}).toThrow();
32+
}).toThrow(
33+
new SolanaError(SOLANA_ERROR__MALFORMED_BIGINT_STRING, {
34+
value: '123.5',
35+
}),
36+
);
1937
});
2038
it('does not throw when supplied a string that parses as an integer', () => {
2139
expect(() => {

packages/rpc-types/src/__tests__/stringified-number-test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1+
import { SOLANA_ERROR__MALFORMED_NUMBER_STRING, SolanaError } from '@solana/errors';
2+
13
import { assertIsStringifiedNumber } from '../stringified-number';
24

35
describe('assertIsStringifiedNumber()', () => {
46
it("throws when supplied a string that can't parse as a number", () => {
57
expect(() => {
68
assertIsStringifiedNumber('abc');
7-
}).toThrow();
9+
}).toThrow(
10+
new SolanaError(SOLANA_ERROR__MALFORMED_NUMBER_STRING, {
11+
value: 'abc',
12+
}),
13+
);
814
expect(() => {
915
assertIsStringifiedNumber('123a');
10-
}).toThrow();
16+
}).toThrow(
17+
new SolanaError(SOLANA_ERROR__MALFORMED_NUMBER_STRING, {
18+
value: '123a',
19+
}),
20+
);
1121
});
1222
it('does not throw when supplied a string that parses as a float', () => {
1323
expect(() => {

0 commit comments

Comments
 (0)