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

In Context::handle_error_fatal, print cause chain. #3563

Merged
merged 3 commits into from
Mar 7, 2023

Conversation

kpreid
Copy link
Contributor

@kpreid kpreid commented Mar 7, 2023

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Fixes #3551.

Description
In Context::handle_error_fatal, print cause chain using the same formatting as for non-fatal errors.

Also add #[track_caller] so that the panic location is specific to the error.

Testing
Manually tested using an application with a deliberately introduced error. Example result:

thread 'main' panicked at 'Error in RenderBundleEncoder::finish: Validation Error

Caused by:
    In a set_pipeline command
      note: render pipeline = `BloomPipelines::downsample_pipeline`
    Render pipeline targets are incompatible with render pass
    Incompatible color attachment: the renderpass expected [] but was given [Some(Rgba16Float)]
', /Users/kpreid/Projects/rust/wgpu/wgpu/src/backend/direct.rs:2105:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Previously, the message would have ended at "In a set_pipeline command".

@kpreid
Copy link
Contributor Author

kpreid commented Mar 7, 2023

One possible flaw in this PR is that some fatal errors probably should not be described as "Validation Error"s (which format_error currently does unconditionally). I don't know exactly which ones, though.

@cwfitzgerald
Copy link
Member

Fatal errors are almost all not supposed to be fatal, we just haven't implemented non-fatality yet.

@cwfitzgerald cwfitzgerald merged commit 13d2c36 into gfx-rs:master Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

handle_error_fatal does not print the complete error
2 participants