diff options
Diffstat (limited to 'ext/fetch/23_response.js')
-rw-r--r-- | ext/fetch/23_response.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js index 94fc69a98..7dad8c047 100644 --- a/ext/fetch/23_response.js +++ b/ext/fetch/23_response.js @@ -172,7 +172,7 @@ function initializeAResponse(response, init, bodyWithType) { // 1. if ((init.status < 200 || init.status > 599) && init.status != 101) { throw new RangeError( - `The status provided (${init.status}) is not equal to 101 and outside the range [200, 599].`, + `The status provided (${init.status}) is not equal to 101 and outside the range [200, 599]`, ); } @@ -181,7 +181,9 @@ function initializeAResponse(response, init, bodyWithType) { init.statusText && RegExpPrototypeExec(REASON_PHRASE_RE, init.statusText) === null ) { - throw new TypeError("Status text is not valid."); + throw new TypeError( + `Invalid status text: "${init.statusText}"`, + ); } // 3. @@ -263,7 +265,7 @@ class Response { const baseURL = getLocationHref(); const parsedURL = new URL(url, baseURL); if (!redirectStatus(status)) { - throw new RangeError("Invalid redirect status code."); + throw new RangeError(`Invalid redirect status code: ${status}`); } const inner = newInnerResponse(status); inner.type = "default"; @@ -395,7 +397,7 @@ class Response { clone() { webidl.assertBranded(this, ResponsePrototype); if (this[_body] && this[_body].unusable()) { - throw new TypeError("Body is unusable."); + throw new TypeError("Body is unusable"); } const second = webidl.createBranded(Response); const newRes = cloneInnerResponse(this[_response]); |