We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a3e08ee commit a603fc5Copy full SHA for a603fc5
crates/wasmtime/src/trap.rs
@@ -264,6 +264,16 @@ impl Trap {
264
}
265
266
267
+ /// Displays the error reason for this trap.
268
+ ///
269
+ /// In particular, it differs from this struct's `Display` by *only*
270
+ /// showing the reason, and not the full backtrace. This is useful to
271
+ /// customize the way the trap is reported, for instance to display a short
272
+ /// message for user-facing errors.
273
+ pub fn display_reason<'a>(&'a self) -> impl fmt::Display + 'a {
274
+ &self.inner.reason
275
+ }
276
+
277
/// Returns a list of function frames in WebAssembly code that led to this
278
/// trap happening.
279
pub fn trace(&self) -> &[FrameInfo] {
0 commit comments