1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

refactor(ext): align error messages (#25914)

Aligns the error messages in the ext folder to be in-line with the Deno
style guide.

https://github.com/denoland/deno/issues/25269

<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
This commit is contained in:
Ian Bull 2024-10-01 11:26:06 -07:00 committed by GitHub
parent 4c8d57db03
commit 41a70898ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View file

@ -124,17 +124,19 @@ function loadTlsKeyPair(api, {
// Check for "pem" format // Check for "pem" format
if (keyFormat !== undefined && keyFormat !== "pem") { 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) { if (cert !== undefined && key === undefined) {
throw new TypeError( 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) { if (cert === undefined && key !== undefined) {
throw new TypeError( 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}\``,
); );
} }

View file

@ -139,7 +139,7 @@ class URLSearchParams {
throw new TypeError( throw new TypeError(
`${prefix}: Item ${ `${prefix}: Item ${
i + 0 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]]; return [pair[0], pair[1]];