From c95fe67b594a8be63f9afc19e0051f9a7266a0b2 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Fri, 25 Jun 2021 11:35:18 +0200 Subject: [PATCH] Add a way to display only the trap's reason (without the backtrace) --- crates/wasmtime/src/trap.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/wasmtime/src/trap.rs b/crates/wasmtime/src/trap.rs index 602d73eb83b9..e1b483b964fc 100644 --- a/crates/wasmtime/src/trap.rs +++ b/crates/wasmtime/src/trap.rs @@ -264,6 +264,11 @@ impl Trap { } } + /// Displays the error reason for this trap. + pub fn display_reason(&self) -> &impl fmt::Display { + &self.inner.reason + } + /// Returns a list of function frames in WebAssembly code that led to this /// trap happening. pub fn trace(&self) -> &[FrameInfo] {