diff --git a/src/error.nobj.lua b/src/error.nobj.lua index 421d5d9..b5559c7 100644 --- a/src/error.nobj.lua +++ b/src/error.nobj.lua @@ -283,12 +283,15 @@ error_code "ZMQ_Error" "int" { ffi_is_error_check = function(rec) return "(-1 == ${" .. rec.name .. "})" end, default = "0", c_source [[ + int num; if(-1 == err) { /* get ZErrors table. */ lua_pushlightuserdata(L, zmq_ZErrors_key); lua_rawget(L, LUA_REGISTRYINDEX); /* convert zmq_errno to string. */ - lua_rawgeti(L, -1, zmq_errno()); + num = zmq_errno(); + lua_pushinteger(L, num); + lua_gettable(L, -2); /* remove ZErrors table. */ lua_remove(L, -2); if(!lua_isnil(L, -1)) { @@ -297,7 +300,8 @@ error_code "ZMQ_Error" "int" { } /* Unknown error. */ lua_pop(L, 1); - err_str = "UNKNOWN ERROR"; + lua_pushfstring(L, "UNKNOWN ERROR(%d)", num); + return; } ]], ffi_source [[ diff --git a/src/pre_generated-zmq.nobj.c b/src/pre_generated-zmq.nobj.c index d3d6544..8933b5c 100644 --- a/src/pre_generated-zmq.nobj.c +++ b/src/pre_generated-zmq.nobj.c @@ -4002,12 +4002,15 @@ static int ZErrors____index__meth(lua_State *L) { static void error_code__ZMQ_Error__push(lua_State *L, ZMQ_Error err) { const char *err_str = NULL; + int num; if(-1 == err) { /* get ZErrors table. */ lua_pushlightuserdata(L, zmq_ZErrors_key); lua_rawget(L, LUA_REGISTRYINDEX); /* convert zmq_errno to string. */ - lua_rawgeti(L, -1, zmq_errno()); + num = zmq_errno(); + lua_pushinteger(L, num); + lua_gettable(L, -2); /* remove ZErrors table. */ lua_remove(L, -2); if(!lua_isnil(L, -1)) { @@ -4016,7 +4019,8 @@ static void error_code__ZMQ_Error__push(lua_State *L, ZMQ_Error err) { } /* Unknown error. */ lua_pop(L, 1); - err_str = "UNKNOWN ERROR"; + lua_pushfstring(L, "UNKNOWN ERROR(%d)", num); + return; } if(err_str) {