shame
shame copied to clipboard
error excerpts require execution from the project root directory
trafficstars
when pipeline encoding errors are triggered, they normally are displayed with an error excerpt. e.g. if we modify the api_showcase example to trigger an error and use
cargo run --bin api_showcase
the following output is generated
shame encoding error:
--> examples/api_showcase/src/main.rs:211:26
|
210 | // Rasterization gives access to the fragment-stage api via `frag`
211 > let frag = primitive.rasterize_multisample([1].into() ,sm::Accuracy::Relaxed);
| ^
|
multisample/supersample rasterization requires a sampling mask with at least 2 samples. Only 1 sample(s) was/were requested
however if the current directory is not the project root, e.g. because we navigate into the inner crate's folder
cd examples/api_showcase
cargo run
the following output is generated
shame encoding error:
--> examples/api_showcase/src/main.rs:211:26
[code excerpt not found]
multisample/supersample rasterization requires a sampling mask with at least 2 samples. Only 1 sample(s) was/were requested
because reading the file examples/api_showcase/src/main.rs fails from this directory.
potential solutions are
- add an interface for the user to specify a prefix (e.g.
../../) - if reading the file fails, check if the
std::env::current_dir()contains parts of the error path, subtract that overlap and try reading again - accept this as the behavior of error excerpts