blueloveTH 2 ani în urmă
părinte
comite
f4e3bc2308
2 a modificat fișierele cu 8 adăugiri și 3 ștergeri
  1. 5 0
      c_bindings/pocketpy_c.cpp
  2. 3 3
      src/vm.h

+ 5 - 0
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; \
     }
 
 

+ 3 - 3
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();