Skip to content

Commit

Permalink
fix(cli): deno doc panics on invalid url (denoland#11536)
Browse files Browse the repository at this point in the history
  • Loading branch information
F3n67u committed Jul 29, 2021
1 parent 4641aac commit 935083d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cli/tests/doc/invalid_url.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error: invalid URL: invalid domain character

Caused by:
invalid domain character
6 changes: 6 additions & 0 deletions cli/tests/integration/doc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ itest!(deno_doc_types_header_direct {
output: "doc/types_header.out",
http_server: true,
});

itest!(deno_doc_invalid_url {
args: "doc https://raw.githubusercontent.com%2Fdyedgreen%2Fdeno-sqlite%2Frework_api%2Fmod.ts",
output: "doc/invalid_url.out",
exit_code: 1,
});
2 changes: 1 addition & 1 deletion cli/tools/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub async fn print_docs(
get_types(flags.unstable).as_str(),
)
} else {
let module_specifier = resolve_url_or_path(&source_file).unwrap();
let module_specifier = resolve_url_or_path(&source_file)?;

// If the root module has external types, the module graph won't redirect it,
// so instead create a dummy file which exports everything from the actual file being documented.
Expand Down

0 comments on commit 935083d

Please sign in to comment.