Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): deno doc panics on invalid url #11536

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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