[ox/std] Make ox::make handle std::exception to report what()
This commit is contained in:
		
							
								
								
									
										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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user