From b16b2a7ff135dfe58c70c2f19f2b76411f1cb5a6 Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Mon, 1 Jul 2019 01:23:08 -0400 Subject: [PATCH] maraiah: add backtrace macro --- maraiah/err.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/maraiah/err.rs b/maraiah/err.rs index a6bc647..9a7ae20 100644 --- a/maraiah/err.rs +++ b/maraiah/err.rs @@ -32,6 +32,15 @@ macro_rules! bail { }; } +#[macro_export] +macro_rules! backtrace { + ($e:expr) => { + if cfg!(debug_assertions) { + dbg!($e.backtrace()); + } + } +} + /// Returns an `Error` with a static string. /// /// # Examples