formatting

This commit is contained in:
ThePhD 2016-02-27 08:04:02 -05:00
parent 0113fb86b4
commit 4ed197f065
3 changed files with 22 additions and 22 deletions

View File

@ -170,7 +170,7 @@ private:
returncount = poststacksize - firstreturn;
}
// Handle C++ errors thrown from C++ functions bound inside of lua
catch (const char* error) {
catch (const char* error) {
h.stackindex = 0;
stack::push(lua_state(), error);
firstreturn = lua_gettop(lua_state());

View File

@ -48,19 +48,19 @@ inline int static_trampoline (lua_State* L) {
template <typename Fx>
inline int trampoline(lua_State* L, Fx&& f) {
try {
return f(L);
}
catch (const char *s) { // Catch and convert exceptions.
lua_pushstring(L, s);
}
catch (const std::exception& e) {
lua_pushstring(L, e.what());
}
catch (...) {
lua_pushstring(L, "caught (...) exception");
}
return lua_error(L);
try {
return f(L);
}
catch (const char *s) { // Catch and convert exceptions.
lua_pushstring(L, s);
}
catch (const std::exception& e) {
lua_pushstring(L, e.what());
}
catch (...) {
lua_pushstring(L, "caught (...) exception");
}
return lua_error(L);
}
inline int c_trampoline(lua_State* L, lua_CFunction f) {

View File

@ -1201,16 +1201,16 @@ TEST_CASE( "functions/function_result-protected_function_result", "Function resu
luadoom.error_handler = cpphandler;
{
sol::protected_function_result result = doom();
REQUIRE(!result.valid());
std::string errorstring = result;
REQUIRE(errorstring == handlederrormessage);
sol::protected_function_result result = doom();
REQUIRE(!result.valid());
std::string errorstring = result;
REQUIRE(errorstring == handlederrormessage);
}
{
sol::protected_function_result result = luadoom();
REQUIRE(!result.valid());
std::string errorstring = result;
REQUIRE(errorstring == handlederrormessage);
sol::protected_function_result result = luadoom();
REQUIRE(!result.valid());
std::string errorstring = result;
REQUIRE(errorstring == handlederrormessage);
}
}