summaryrefslogtreecommitdiff
path: root/ext/fetch
diff options
context:
space:
mode:
authorIan Bull <irbull@eclipsesource.com>2024-09-18 18:19:45 -0700
committerGitHub <noreply@github.com>2024-09-18 18:19:45 -0700
commit282c4c262d3a19fe3ae3fd9ea75811b816e65dc1 (patch)
tree51ad919b29949215d5b9920097f04d24e062c4a7 /ext/fetch
parentfd23e8ec4f815f273a348d528edbc3bf65a21b5f (diff)
refactor(ext): align error messages (#25496)
Aligns the error messages in the ext/http and a few messages in the ext/fetch folder to be in-line with the Deno style guide. This change-set also removes some unnecessary checks in the 00_serve.ts. These options were recently removed, so it doesn't make sense to check for them anymore. https://github.com/denoland/deno/issues/25269
Diffstat (limited to 'ext/fetch')
-rw-r--r--ext/fetch/23_request.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js
index adebe13b3..6211e927d 100644
--- a/ext/fetch/23_request.js
+++ b/ext/fetch/23_request.js
@@ -122,7 +122,7 @@ function newInnerRequest(method, url, headerList, body, maybeBlob) {
try {
this.headerListInner = headerList();
} catch {
- throw new TypeError("cannot read headers: request closed");
+ throw new TypeError("Cannot read headers: request closed");
}
}
return this.headerListInner;
@@ -153,7 +153,7 @@ function newInnerRequest(method, url, headerList, body, maybeBlob) {
try {
this.urlListProcessed[currentIndex] = this.urlList[currentIndex]();
} catch {
- throw new TypeError("cannot read url: request closed");
+ throw new TypeError("Cannot read url: request closed");
}
}
return this.urlListProcessed[currentIndex];
@@ -193,7 +193,7 @@ function cloneInnerRequest(request, skipBody = false) {
try {
this.urlListProcessed[0] = this.urlList[0]();
} catch {
- throw new TypeError("cannot read url: request closed");
+ throw new TypeError("Cannot read url: request closed");
}
}
return this.urlListProcessed[0];
@@ -204,7 +204,7 @@ function cloneInnerRequest(request, skipBody = false) {
try {
this.urlListProcessed[currentIndex] = this.urlList[currentIndex]();
} catch {
- throw new TypeError("cannot read url: request closed");
+ throw new TypeError("Cannot read url: request closed");
}
}
return this.urlListProcessed[currentIndex];
@@ -236,13 +236,13 @@ const KNOWN_METHODS = {
*/
function validateAndNormalizeMethod(m) {
if (RegExpPrototypeExec(HTTP_TOKEN_CODE_POINT_RE, m) === null) {
- throw new TypeError("Method is not valid.");
+ throw new TypeError("Method is not valid");
}
const upperCase = byteUpperCase(m);
if (
upperCase === "CONNECT" || upperCase === "TRACE" || upperCase === "TRACK"
) {
- throw new TypeError("Method is forbidden.");
+ throw new TypeError("Method is forbidden");
}
return upperCase;
}
@@ -418,7 +418,7 @@ class Request {
((init.body !== undefined && init.body !== null) ||
inputBody !== null)
) {
- throw new TypeError("Request with GET/HEAD method cannot have body.");
+ throw new TypeError("Request with GET/HEAD method cannot have body");
}
// 36.
@@ -442,7 +442,7 @@ class Request {
// 41.
if (initBody === null && inputBody !== null) {
if (input[_body] && input[_body].unusable()) {
- throw new TypeError("Input request's body is unusable.");
+ throw new TypeError("Input request's body is unusable");
}
finalBody = inputBody.createProxy();
}
@@ -489,7 +489,7 @@ class Request {
const prefix = "Failed to execute 'Request.clone'";
webidl.assertBranded(this, RequestPrototype);
if (this[_body] && this[_body].unusable()) {
- throw new TypeError("Body is unusable.");
+ throw new TypeError("Body is unusable");
}
const clonedReq = cloneInnerRequest(this[_request]);