[ox/std] Make ox::make handle std::exception to report what()
This commit is contained in:
parent
ead3fd39c4
commit
da6eb40966
5
deps/ox/src/ox/std/new.hpp
vendored
5
deps/ox/src/ox/std/new.hpp
vendored
@ -41,8 +41,11 @@ constexpr T *make(Args &&...args) noexcept {
|
|||||||
#ifdef __cpp_exceptions
|
#ifdef __cpp_exceptions
|
||||||
try {
|
try {
|
||||||
return new T(ox::forward<Args>(args)...);
|
return new T(ox::forward<Args>(args)...);
|
||||||
|
} catch (std::exception const&ex) {
|
||||||
|
oxPanic(OxError(1, ex.what()), ex.what());
|
||||||
|
return nullptr;
|
||||||
} catch (...) {
|
} 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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user