alexcrichton commented on Issue #1792:
This is actually intentional I believe that
Display for TwhereT: Errorshould only print one "stack frame" of error. The full backtrace of errors (causes) should be printed elsewhere. The connection viafn sourceshould cause other libraries, likeanyhowprint the full list of causes. Could you elaborate a bit on how this came up for you?
github-actions[bot] commented on Issue #1792:
Subscribe to Label Action
cc @peterhuene
<details>
This issue or pull request has been labeled: "wasmtime:api"Thus the following users have been cc'd because of the following labels:
- peterhuene: wasmtime:api
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
leoyvens commented on Issue #1792:
@alexcrichton It didn't actually come up for me, but I think the full information is what we want in the context of this impl. The only use of this
Displayimpl is here https://github.com/bytecodealliance/wasmtime/blob/master/crates/wasmtime/src/trap.rs#L190 where we proceed to print the full WASM backtrace, and therefore are probably also interested in the full list of causes. It might be clearer if thisDisplayimpl was removed and inlined there.
alexcrichton commented on Issue #1792:
The purpose of
Displayfor each error in the backtrace of errors is to print just that specific error. Part of wasm errors is the wasm callstack, so they're printed with wasm traps. Idiomatic error handling in Rust would not work ifTrapprinted out its own backtrace of errors, because then it would be incompatible with crates likeanyhowwhich assume errors don't do that.
leoyvens commented on Issue #1792:
@alexcrichton I think I get it, so if I want to print causes, I should do something like:
format!("{:#}", anyhow::Error::from(trap));And we don't want that to print the causes twice.
Would it make sense to support
{:#}directly in theDisplayforTrapReasonandTrap, as convenience so this can be justformat!("{:#}", trap).
leoyvens edited a comment on Issue #1792:
@alexcrichton I think I get it, so if I want to print causes, I should do something like:
format!("{:#}", anyhow::Error::from(trap));And we don't want that to print the causes twice.
Would it make sense to support
{:#}directly in theDisplayforTrapReasonandTrap, as convenience so this can be justformat!("{:#}", trap)?
alexcrichton commented on Issue #1792:
AFAIK most types implementing
Errordo not support the ability to print their full backtrace. To do that you need to either write your own function or use a catch-all error type likeanyhow::Errorwhich explicitly has support for this (or convert toBox<Error + ...>)
leoyvens commented on Issue #1792:
Alright, closing this then, thanks for the explanations.
Last updated: Dec 13 2025 at 19:03 UTC