Skip to content

Commit

Permalink
Detailed errors for include_file! (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc authored Feb 17, 2023
1 parent eda4854 commit 09d9d68
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/re_renderer/src/file_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ macro_rules! include_file {
.unwrap()
.join($path);

$crate::FileServer::get_mut(|fs| fs.watch(&mut resolver, &file_path, false)).unwrap()
use anyhow::Context as _;
$crate::FileServer::get_mut(|fs| fs.watch(&mut resolver, &file_path, false))
.with_context(|| format!("include_file!({}) (rooted at {:?}) failed while trying to import physical path {file_path:?}", $path, file!()))
.unwrap()
}

#[cfg(not(all(not(target_arch = "wasm32"), debug_assertions)))] // otherwise
Expand Down Expand Up @@ -60,7 +63,10 @@ macro_rules! include_file {
//
// Therefore, the in-memory filesystem will actually be able to find this path,
// and canonicalize it.
$crate::get_filesystem().canonicalize(&path).unwrap()
use anyhow::Context as _;
$crate::get_filesystem().canonicalize(&path)
.with_context(|| format!("include_file!({}) (rooted at {:?}) failed while trying to import virtual path {path:?}", $path, file!()))
.unwrap()
}
}};
}
Expand Down

0 comments on commit 09d9d68

Please sign in to comment.