Skip to content

Commit 57126da

Browse files
committed
SyntaxError probably isnt quite accurate
1 parent 8c8ed64 commit 57126da

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/parse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function parse(serialized) {
1717
if (typeof parsed === 'number') return hydrate(parsed, true);
1818

1919
if (!Array.isArray(parsed) || parsed.length === 0) {
20-
throw new SyntaxError('Invalid input');
20+
throw new Error('Invalid input');
2121
}
2222

2323
const values = /** @type {any[]} */ (parsed);
@@ -32,7 +32,7 @@ export function parse(serialized) {
3232
if (index === NEGATIVE_INFINITY) return -Infinity;
3333
if (index === NEGATIVE_ZERO) return -0;
3434

35-
if (standalone) throw new SyntaxError(`Invalid input`);
35+
if (standalone) throw new Error(`Invalid input`);
3636

3737
if (index in hydrated) return hydrated[index];
3838

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ for (const { name, json, message } of invalid) {
442442
uvu.test(`parse error: ${name}`, () => {
443443
assert.throws(
444444
() => parse(json),
445-
(error) => error instanceof SyntaxError && error.message === message
445+
(error) => error.message === message
446446
);
447447
});
448448
}

0 commit comments

Comments
 (0)