Skip to content

Commit 017eb8d

Browse files
committed
fix: throw TypeError from multi-byte strict errors
1 parent 595b0c7 commit 017eb8d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fallback/multi-byte.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export function multibyteDecoder(enc, loose = false) {
336336
// Decoders big5, euc-jp, euc-kr, shift_jis, gb18030 / gbk - all clear state before throwing unless EOF, so not affected
337337
// iso-2022-jp is the only tricky one one where this !stream check matters in non-stream mode
338338
if (!stream) mapper = null // destroy state, effectively the same as 'do not flush' = false, but early
339-
throw new Error(E_STRICT)
339+
throw new TypeError(E_STRICT)
340340
}
341341

342342
let res = ''
@@ -399,7 +399,7 @@ function big5decoder(loose) {
399399
: () => {
400400
pushback.length = 0 // the queue is cleared on returning an error
401401
// Lead is always already cleared before throwing
402-
throw new Error(E_STRICT)
402+
throw new TypeError(E_STRICT)
403403
}
404404

405405
let res = ''

0 commit comments

Comments
 (0)