From 282c4c262d3a19fe3ae3fd9ea75811b816e65dc1 Mon Sep 17 00:00:00 2001 From: Ian Bull Date: Wed, 18 Sep 2024 18:19:45 -0700 Subject: 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 --- tests/unit/serve_test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/serve_test.ts b/tests/unit/serve_test.ts index d417d8d26..439d71d55 100644 --- a/tests/unit/serve_test.ts +++ b/tests/unit/serve_test.ts @@ -1592,7 +1592,7 @@ Deno.test( Deno.upgradeWebSocket(request); }, Deno.errors.Http, - "already upgraded", + "Already upgraded", ); socket.onerror = (e) => { console.error(e); @@ -3694,7 +3694,7 @@ Deno.test( } catch (cloneError) { assert(cloneError instanceof TypeError); assert( - cloneError.message.endsWith("Body is unusable."), + cloneError.message.endsWith("Body is unusable"), ); ac.abort(); @@ -3743,7 +3743,7 @@ Deno.test({ } catch (cloneError) { assert(cloneError instanceof TypeError); assert( - cloneError.message.endsWith("Body is unusable."), + cloneError.message.endsWith("Body is unusable"), ); ac.abort(); @@ -3895,7 +3895,7 @@ async function readTrailers( const tp = new TextProtoReader(r); const result = await tp.readMimeHeader(); if (result == null) { - throw new Deno.errors.InvalidData("Missing trailer header."); + throw new Deno.errors.InvalidData("Missing trailer header"); } const undeclared = [...result.keys()].filter( (k) => !trailerNames.includes(k), @@ -3923,7 +3923,7 @@ function parseTrailer(field: string | null): Headers | undefined { } const trailerNames = field.split(",").map((v) => v.trim().toLowerCase()); if (trailerNames.length === 0) { - throw new Deno.errors.InvalidData("Empty trailer header."); + throw new Deno.errors.InvalidData("Empty trailer header"); } const prohibited = trailerNames.filter((k) => isProhibitedForTrailer(k)); if (prohibited.length > 0) { -- cgit v1.2.3