Skip to main content

error_chain

Function error_chain 

Source
pub fn error_chain(err: &dyn Error) -> String
Expand description

An error and every cause behind it, as outer: inner: innermost.

err.to_string() is the wrong thing to report and this exists to replace it. Every error type here is a thiserror enum whose variants carry a #[source], and Display prints only the outermost line. So a plugin that failed to instantiate reported exactly failed to instantiate the plugin component — the category, never the reason — while the wasmtime error saying which import was missing or which type did not match sat one link down, discarded.

That is a bad outcome anywhere and a specially bad one here, because the message is the whole product: record_failure exists (its comment says so) because a missing diagnostic once cost a debugging session, and it was itself throwing away the half that identifies the fault. The generic line then sends every reader to the same wrong fix, since the view’s footer suggests --wit-sync whether or not the ABI has anything to do with it.

Bounded at eight links: a chain longer than that is a wrapper bug, and an unbounded walk over a cyclic source() would hang the loader rather than report anything.