From da6eb40966f844ecef09bc730cd7a6f4f6bd2824 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 9 Aug 2023 00:01:17 -0500 Subject: [PATCH] [ox/std] Make ox::make handle std::exception to report what() --- deps/ox/src/ox/std/new.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deps/ox/src/ox/std/new.hpp b/deps/ox/src/ox/std/new.hpp index 369311f8..a2435b8e 100644 --- a/deps/ox/src/ox/std/new.hpp +++ b/deps/ox/src/ox/std/new.hpp @@ -41,8 +41,11 @@ constexpr T *make(Args &&...args) noexcept { #ifdef __cpp_exceptions try { return new T(ox::forward(args)...); + } catch (std::exception const&ex) { + oxPanic(OxError(1, ex.what()), ex.what()); + return nullptr; } catch (...) { - oxPanic(OxError(1, "Allocation or constructor failed"), "Allocation or constructor failed"); + oxPanic(OxError(2, "Allocation or constructor failed"), "Allocation or constructor failed"); return nullptr; } #else