Пример #1
0
LUABIND_API void handle_exception_aux(lua_State* L)
{
    try
    {
        if (handler_chain)
            handler_chain->handle(L);
        else
            throw;
    }
    catch (error const&)
    {}
    catch (std::logic_error const& e)
    {
        push_exception_string(L, "std::logic_error", e.what());
    }
    catch (std::runtime_error const& e)
    {
        push_exception_string(L, "std::runtime_error", e.what());
    }
    catch (std::exception const& e)
    {
        push_exception_string(L, "std::exception", e.what());
    }
    catch (char const* str)
    {
        push_exception_string(L, "c-string", str);
    }
    catch (...)
    {
        lua_pushstring(L, "Unknown C++ exception");
    }
}
		LUABIND_API void handle_exception_aux(lua_State* L)
		{
			try
			{
				if(handler_chain)
					handler_chain->handle(L);
				else
					throw;
			}
			catch(error const&)
			{
				// is always thrown in the context where an error message was already pushed to the lua stack.
			}
			catch(std::logic_error const& e)
			{
				push_exception_string(L, "std::logic_error", e.what());
			}
			catch(std::runtime_error const& e)
			{
				push_exception_string(L, "std::runtime_error", e.what());
			}
			catch(std::exception const& e)
			{
				push_exception_string(L, "std::exception", e.what());
			}
			catch(char const* str)
			{
				push_exception_string(L, "c-string", str);
			}
			catch(...)
			{
				lua_pushstring(L, "Unknown C++ exception");
			}
		}