diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-08-08 15:49:00 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-08-08 18:35:26 -0700 |
commit | 69f73ee368e07e6e11301c0ab4c42444e92ed635 (patch) | |
tree | df3f7a897b932e81164c9d6a737331b70845fbe5 /src | |
parent | f632797bc8d6e39c524e2e855c56bb15c2997ac9 (diff) |
Hacky error handling for Url::from_file_path.
Diffstat (limited to 'src')
-rw-r--r-- | src/deno_dir.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/deno_dir.rs b/src/deno_dir.rs index b3a4c029b..cabd9ed92 100644 --- a/src/deno_dir.rs +++ b/src/deno_dir.rs @@ -165,12 +165,27 @@ impl DenoDir { let j: Url = if containing_file == "." || Path::new(module_specifier).is_absolute() { - Url::from_file_path(module_specifier).unwrap() + let r = Url::from_file_path(module_specifier); + // TODO(ry) Properly handle error. + if r.is_err() { + error!("Url::from_file_path error {}", module_specifier); + } + r.unwrap() } else if containing_file.ends_with("/") { - let base = Url::from_directory_path(&containing_file).unwrap(); + let r = Url::from_directory_path(&containing_file); + // TODO(ry) Properly handle error. + if r.is_err() { + error!("Url::from_directory_path error {}", containing_file); + } + let base = r.unwrap(); base.join(module_specifier)? } else { - let base = Url::from_file_path(&containing_file).unwrap(); + let r = Url::from_file_path(&containing_file); + // TODO(ry) Properly handle error. + if r.is_err() { + error!("Url::from_file_path error {}", containing_file); + } + let base = r.unwrap(); base.join(module_specifier)? }; |