From f4e3bc2308fcfd54766fcf3dedd1d5b2f745751b Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 26 May 2023 15:48:06 +0800 Subject: [PATCH] ... --- c_bindings/pocketpy_c.cpp | 5 +++++ src/vm.h | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/c_bindings/pocketpy_c.cpp b/c_bindings/pocketpy_c.cpp index 6cff8b0a..1901f94c 100644 --- a/c_bindings/pocketpy_c.cpp +++ b/c_bindings/pocketpy_c.cpp @@ -15,6 +15,11 @@ using namespace pkpy; vm->c_data->push(py_var(vm, e)); \ vm->c_data->push(NULL); \ return false; \ + } catch(const std::exception& re){ \ + auto e = Exception("std::exception", re.what()); \ + vm->c_data->push(py_var(vm, e)); \ + vm->c_data->push(NULL); \ + return false; \ } diff --git a/src/vm.h b/src/vm.h index 79e4bfb2..f36cfce7 100644 --- a/src/vm.h +++ b/src/vm.h @@ -220,9 +220,9 @@ public: } #if !DEBUG_FULL_EXCEPTION catch (const std::exception& e) { - _stderr(this, "An std::exception occurred! It could be a bug.\n"); - _stderr(this, e.what()); - _stderr(this, "\n"); + Str msg = "An std::exception occurred! It could be a bug.\n"; + msg = msg + e.what(); + _stderr(this, msg + "\n"); } #endif callstack.clear();