| 191 | */ |
| 192 | template<typename T, typename F> |
| 193 | T WrapThrowablePointer(F&& func, typename std::enable_if<std::is_pointer<T>::value, int>::type _ = 0) |
| 194 | { |
| 195 | try |
| 196 | { |
| 197 | return func(); |
| 198 | } |
| 199 | catch (const std::exception& e) |
| 200 | { |
| 201 | // TODO: How to handle this? |
| 202 | // g_lastExceptionMessage = e.what(); |
| 203 | LogError("%s", e.what()); |
| 204 | return nullptr; |
| 205 | } |
| 206 | catch (...) |
| 207 | { |
| 208 | return nullptr; |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | /*! |
| 213 | Wrap a throwable block in a try/catch, passing through the return value on success. |