From ebe3b1047acd2d4806b4f39cd9e80533e20aeab6 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Sun, 25 Sep 2016 18:52:13 -0700 Subject: [PATCH] feat(library/vm/vm_exceptional): handle formatted_exception --- src/library/vm/vm_exceptional.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/library/vm/vm_exceptional.cpp b/src/library/vm/vm_exceptional.cpp index 8cc3f0f809..470980eb83 100644 --- a/src/library/vm/vm_exceptional.cpp +++ b/src/library/vm/vm_exceptional.cpp @@ -48,11 +48,11 @@ vm_obj throwable_to_format(vm_obj const & _ex, vm_obj const & _opts) { formatter fmt = ios.get_formatter(); return to_obj(kex->pp(fmt)); } + } else if (auto fex = dynamic_cast(ex)) { + return to_obj(fex->pp()); + } else { + return to_obj(format(ex->what())); } - - /* TODO(Leo): add support for other exception types that may generate interesting format */ - - return to_obj(format(ex->what())); } static unsigned g_throwable_to_format_fun_idx = -1;