summaryrefslogtreecommitdiff
path: root/ext/fetch/26_fetch.js
diff options
context:
space:
mode:
authorIan Bull <irbull@gmail.com>2024-09-04 00:05:29 -0700
committerGitHub <noreply@github.com>2024-09-04 09:05:29 +0200
commitce6b6751028bfe08b49628a30e660ff479eded02 (patch)
treeb0262dcbfa8e40aca090486eab959f04ae725ffc /ext/fetch/26_fetch.js
parent7079acd74d583a14f3c09e16f196a6851381439b (diff)
refactor(ext/fetch): align error messages (#25374)
Aligns the error messages in the ext/fetch folder to be in-line with the Deno style guide. https://github.com/denoland/deno/issues/25269
Diffstat (limited to 'ext/fetch/26_fetch.js')
-rw-r--r--ext/fetch/26_fetch.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js
index 47186fb2d..8ac364a93 100644
--- a/ext/fetch/26_fetch.js
+++ b/ext/fetch/26_fetch.js
@@ -99,7 +99,7 @@ function createResponseBodyStream(responseBodyRid, terminator) {
async function mainFetch(req, recursive, terminator) {
if (req.blobUrlEntry !== null) {
if (req.method !== "GET") {
- throw new TypeError("Blob URL fetch only supports GET method.");
+ throw new TypeError("Blob URL fetch only supports GET method");
}
const body = new InnerBody(req.blobUrlEntry.stream());
@@ -145,7 +145,7 @@ async function mainFetch(req, recursive, terminator) {
reqRid = resourceForReadableStream(stream, req.body.length);
}
} else {
- throw new TypeError("invalid body");
+ throw new TypeError("Invalid body");
}
}
@@ -441,13 +441,15 @@ function handleWasmStreaming(source, rid) {
typeof contentType !== "string" ||
StringPrototypeToLowerCase(contentType) !== "application/wasm"
) {
- throw new TypeError("Invalid WebAssembly content type.");
+ throw new TypeError("Invalid WebAssembly content type");
}
}
// 2.5.
if (!res.ok) {
- throw new TypeError(`HTTP status code ${res.status}`);
+ throw new TypeError(
+ `Failed to receive WebAssembly content: HTTP status code ${res.status}`,
+ );
}
// Pass the resolved URL to v8.