diff options
author | Ian Bull <irbull@eclipsesource.com> | 2024-08-28 16:40:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-28 22:40:37 +0200 |
commit | 6ccaebcdeae95a82b270ac5bde78b65b37fadb45 (patch) | |
tree | 4c50dc3aa74ef6bef2aca4706af8b16213b1e1f2 /ext/web | |
parent | 231bdc0aa0c08914735001f5e1261e1808d68190 (diff) |
refactor(ext): throw new error instead of throw error (#25272)
To ensure consistency across the codebase, this commit refactors the
code in the `ext` folder to use `throw new Error`` instead of `throw`
for throwing errors.
Fixes https://github.com/denoland/deno/issues/25270
Diffstat (limited to 'ext/web')
-rw-r--r-- | ext/web/00_infra.js | 2 | ||||
-rw-r--r-- | ext/web/06_streams.js | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/web/00_infra.js b/ext/web/00_infra.js index e42f2cc93..4b241ab5d 100644 --- a/ext/web/00_infra.js +++ b/ext/web/00_infra.js @@ -133,7 +133,7 @@ function regexMatcher(chars) { ); return `\\u${a}-\\u${b}`; } else { - throw TypeError("unreachable"); + throw new TypeError("unreachable"); } }); return ArrayPrototypeJoin(matchers, ""); diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index 130b24783..3da3fe36c 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -524,10 +524,10 @@ function dequeueValue(container) { function enqueueValueWithSize(container, value, size) { assert(container[_queue] && typeof container[_queueTotalSize] === "number"); if (isNonNegativeNumber(size) === false) { - throw RangeError("chunk size isn't a positive number"); + throw new RangeError("chunk size isn't a positive number"); } if (size === Infinity) { - throw RangeError("chunk size is invalid"); + throw new RangeError("chunk size is invalid"); } container[_queue].enqueue({ value, size }); container[_queueTotalSize] += size; @@ -543,7 +543,7 @@ function extractHighWaterMark(strategy, defaultHWM) { } const highWaterMark = strategy.highWaterMark; if (NumberIsNaN(highWaterMark) || highWaterMark < 0) { - throw RangeError( + throw new RangeError( `Expected highWaterMark to be a positive number or Infinity, got "${highWaterMark}".`, ); } |