From 0704d61ed594ede1e0fd0e277ce9da4b1f5f58bf Mon Sep 17 00:00:00 2001 From: Ian Bull Date: Fri, 27 Sep 2024 09:43:27 -0700 Subject: [PATCH] refactor(ext): align error messages Aligns the error messages in the ext folder to be in-line with the Deno style guide. https://github.com/denoland/deno/issues/25269 --- ext/net/02_tls.js | 8 +++++--- ext/url/00_url.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ext/net/02_tls.js b/ext/net/02_tls.js index 11d19440f7474d..6dad965590eb08 100644 --- a/ext/net/02_tls.js +++ b/ext/net/02_tls.js @@ -124,17 +124,19 @@ function loadTlsKeyPair(api, { // Check for "pem" format if (keyFormat !== undefined && keyFormat !== "pem") { - throw new TypeError('If `keyFormat` is specified, it must be "pem"'); + throw new TypeError( + `If "keyFormat" is specified, it must be "pem": received "${keyFormat}"`, + ); } if (cert !== undefined && key === undefined) { throw new TypeError( - `If \`cert\` is specified, \`key\` must be specified as well for \`${api}\`.`, + `If \`cert\` is specified, \`key\` must be specified as well for \`${api}\``, ); } if (cert === undefined && key !== undefined) { throw new TypeError( - `If \`key\` is specified, \`cert\` must be specified as well for \`${api}\`.`, + `If \`key\` is specified, \`cert\` must be specified as well for \`${api}\``, ); } diff --git a/ext/url/00_url.js b/ext/url/00_url.js index 577caba902f18f..ec875da768d6f9 100644 --- a/ext/url/00_url.js +++ b/ext/url/00_url.js @@ -139,7 +139,7 @@ class URLSearchParams { throw new TypeError( `${prefix}: Item ${ i + 0 - } in the parameter list does have length 2 exactly.`, + } in the parameter list does have length 2 exactly`, ); } return [pair[0], pair[1]];