[ox/std] Make ox::make handle std::exception to report what()

This commit is contained in:
Gary Talent 2023-08-09 00:01:17 -05:00
parent ead3fd39c4
commit da6eb40966

View File

@ -41,8 +41,11 @@ constexpr T *make(Args &&...args) noexcept {
#ifdef __cpp_exceptions
try {
return new T(ox::forward<Args>(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