diff Core/Lua/LuaContext.cpp @ 1583:9ea3d082b064

got rid of custom exceptions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 17:52:50 +0200
parents 33d34bc4ac15
children f2e3d030ea59
line wrap: on
line diff
--- a/Core/Lua/LuaContext.cpp	Tue Aug 25 17:39:38 2015 +0200
+++ b/Core/Lua/LuaContext.cpp	Tue Aug 25 17:52:50 2015 +0200
@@ -34,6 +34,7 @@
 #include "LuaContext.h"
 
 #include "../Logging.h"
+#include "../OrthancException.h"
 
 #include <set>
 #include <cassert>
@@ -369,7 +370,7 @@
     }
     else
     {
-      throw LuaException("Unsupported JSON conversion");
+      throw OrthancException(ErrorCode_JsonToLuaTable);
     }
   }
 
@@ -484,7 +485,7 @@
     lua_ = luaL_newstate();
     if (!lua_)
     {
-      throw LuaException("Unable to create the Lua context");
+      throw OrthancException(ErrorCode_CannotCreateLua);
     }
 
     luaL_openlibs(lua_);
@@ -521,7 +522,7 @@
       std::string description(lua_tostring(lua_, -1));
       lua_pop(lua_, 1); /* pop error message from the stack */
       LOG(ERROR) << "Error while executing Lua script: " << description;
-      throw LuaException(description);
+      throw OrthancException(ErrorCode_CannotExecuteLua);
     }
 
     if (output != NULL)