Skip to content

Commit 1f372a9

Browse files
committed
Wrap DOMExceptions thrown by base64ToArrayBuffer in ParseError
This fixes the remaining 2 test failures: - should parse: padding at beginning - should parse: padding in middle
1 parent 9f57d6e commit 1f372a9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/parser.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,11 @@ export default class Parser {
381381
throw new ParseError(this.pos, 'ByteSequence does not contain a valid base64 string');
382382
}
383383

384-
return base64ToArrayBuffer(b64Content);
384+
try {
385+
return base64ToArrayBuffer(b64Content);
386+
} catch {
387+
throw new ParseError(this.pos, 'ByteSequence does not contain a valid base64 string');
388+
}
385389

386390
}
387391

0 commit comments

Comments
 (0)