Skip to content

Commit

Permalink
refactor(ext): align error messages
Browse files Browse the repository at this point in the history
Aligns the error messages in the ext folder to be in-line with the Deno
style guide.

denoland#25269
  • Loading branch information
irbull committed Sep 27, 2024
1 parent 6f0fbce commit 0704d61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions ext/net/02_tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}\``,
);
}

Expand Down
2 changes: 1 addition & 1 deletion ext/url/00_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
Expand Down

0 comments on commit 0704d61

Please sign in to comment.