| 8795 | #else |
| 8796 | |
| 8797 | inline int lua_cfunction_trampoline(lua_State* L, lua_CFunction f) { |
| 8798 | #if SOL_IS_ON(SOL_PROPAGATE_EXCEPTIONS) |
| 8799 | return f(L); |
| 8800 | #else |
| 8801 | try { |
| 8802 | return f(L); |
| 8803 | } |
| 8804 | catch (const char* cs) { |
| 8805 | call_exception_handler(L, optional<const std::exception&>(nullopt), string_view(cs)); |
| 8806 | } |
| 8807 | catch (const std::string& s) { |
| 8808 | call_exception_handler(L, optional<const std::exception&>(nullopt), string_view(s.c_str(), s.size())); |
| 8809 | } |
| 8810 | catch (const std::exception& e) { |
| 8811 | call_exception_handler(L, optional<const std::exception&>(e), e.what()); |
| 8812 | } |
| 8813 | #if SOL_IS_ON(SOL_EXCEPTIONS_CATCH_ALL) |
| 8814 | // LuaJIT cannot have the catchall when the safe propagation is on |
| 8815 | // but LuaJIT will swallow all C++ errors |
| 8816 | // if we don't at least catch std::exception ones |
| 8817 | catch (...) { |
| 8818 | call_exception_handler(L, optional<const std::exception&>(nullopt), "caught (...) exception"); |
| 8819 | } |
| 8820 | #endif // LuaJIT cannot have the catchall, but we must catch std::exceps for it |
| 8821 | return lua_error(L); |
| 8822 | #endif // Safe exceptions |
| 8823 | } |
| 8824 | |
| 8825 | template <lua_CFunction f> |
| 8826 | int static_trampoline(lua_State* L) { |
no test coverage detected