Closed Chronophylos closed 2 years ago
Some background: the reason TetraError
generally doesn't include the inner errors in the Display
impl is because this doesn't play nicely with error reporting libraries like anyhow
or eyre
, which use Error::source
to print a nice stack with all the nested errors. If you include the source in Display
as well as context
, you get duplication in the output.
For this reason, the Rust error handling project group recommends that nested errors should either be returned from Display
or source
, but not both.
The problem is, for PlatformError
, InvalidShader
, FailedToChangeDisplayMode
and TessellationError
, I'm not returning them from either 🤦🤦🤦
This is an oversight on my part - those four errors can't return their causes from source
(due to the nested types not implementing Error
), so I should show them via Display
instead.
I will try to fix this issue tomorrow.
As a workaround, if you print the error with Debug
, you should be able to see what message is inside it.
Summary
Tetra just throws the actual error message away when displaying a
TetraError::PlatformError
https://github.com/17cupsofcoffee/tetra/blob/main/src/error.rs#L81. Instead it should include the inner error in the messageMotivation/Examples
I have encountered the error and I do not know what caused it
Alternatives Considered
none