diff --git a/compiler+runtime/src/cpp/jank/util/scope_exit.cpp b/compiler+runtime/src/cpp/jank/util/scope_exit.cpp index ea5ed966..e1c485d1 100644 --- a/compiler+runtime/src/cpp/jank/util/scope_exit.cpp +++ b/compiler+runtime/src/cpp/jank/util/scope_exit.cpp @@ -1,4 +1,9 @@ +#include + #include +#include +#include +#include namespace jank::util { @@ -14,6 +19,19 @@ namespace jank::util scope_exit::~scope_exit() { - func(); + try + { + func(); + } + catch(runtime::object_ptr const o) + { + /* TODO: Panic */ + fmt::println(stderr, "Exception caught in scope_exit: {}", runtime::to_string(o)); + } + catch(std::exception const &e) + { + /* TODO: Panic */ + fmt::println(stderr, "Exception caught in scope_exit: {}", e.what()); + } } }