Merge pull request #1485 from danpat/fix/lua_err_display

Return error message when lua error occurs.
This commit is contained in:
Patrick Niklaus 2015-05-22 09:45:26 +02:00
commit 2cd616dd30
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ namespace
{ {
int lua_error_callback(lua_State *lua_state) int lua_error_callback(lua_State *lua_state)
{ {
luabind::object error_msg(luabind::from_stack(lua_state, -1)); std::string error_msg = lua_tostring(lua_state, -1);
std::ostringstream error_stream; std::ostringstream error_stream;
error_stream << error_msg; error_stream << error_msg;
throw osrm::exception("ERROR occured in profile script:\n" + error_stream.str()); throw osrm::exception("ERROR occured in profile script:\n" + error_stream.str());

View File

@ -53,7 +53,7 @@ auto get_value_by_key(T const &object, const char *key) -> decltype(object.get_v
int lua_error_callback(lua_State *L) // This is so I can use my own function as an int lua_error_callback(lua_State *L) // This is so I can use my own function as an
// exception handler, pcall_log() // exception handler, pcall_log()
{ {
luabind::object error_msg(luabind::from_stack(L, -1)); std::string error_msg = lua_tostring(L, -1);
std::ostringstream error_stream; std::ostringstream error_stream;
error_stream << error_msg; error_stream << error_msg;
throw osrm::exception("ERROR occured in profile script:\n" + error_stream.str()); throw osrm::exception("ERROR occured in profile script:\n" + error_stream.str());