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

Detailed errors for include_file! #1339

Merged
merged 3 commits into from
Feb 17, 2023
Merged
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
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