Skip to content

Commit

Permalink
Use DOMException for range errors
Browse files Browse the repository at this point in the history
  • Loading branch information
caspervonb committed Jan 16, 2021
1 parent c9cdb5c commit 75c6164
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion op_crates/web/08_text_encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@
for (let i = 0; i < s.length; i++) {
const charCode = s[i].charCodeAt(0);
if (charCode > 0xff) {
throw new TypeError(
throw new DOMException(
"The string to be encoded contains characters " +
"outside of the Latin1 range.",
"InvalidCharacterError",
);
}
byteArray.push(charCode);
Expand Down

0 comments on commit 75c6164

Please sign in to comment.