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;