mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
Hacky error handling for Url::from_file_path.
This commit is contained in:
parent
f632797bc8
commit
69f73ee368
1 changed files with 18 additions and 3 deletions
|
@ -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)?
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue