@@ -22,10 +22,13 @@ for i, n in ipairs(namespaces) do
end
end
-local status = conn:call("test", "hello", { msg = "eth0" })
-
-for k, v in pairs(status) do
- print("key=" .. k .. " value=" .. tostring(v))
+local status, rc, desc = conn:call("test", "hello", { msg = "eth0" })
+if not status then
+ print("test.hello failed, code, desc: ", rc, desc)
+else
+ for k, v in pairs(status) do
+ print("key=" .. k .. " value=" .. tostring(v))
+ end
end
local status = {conn:call("test", "hello1", { msg = "eth0" })}
@@ -246,7 +246,8 @@ ubus_lua_connect(lua_State *L)
/* NB: no errors from ubus_connect() yet */
lua_pushnil(L);
lua_pushinteger(L, UBUS_STATUS_UNKNOWN_ERROR);
- return 2;
+ lua_pushstring(L, ubus_strerror(UBUS_STATUS_UNKNOWN_ERROR));
+ return 3;
}
@@ -273,7 +274,8 @@ ubus_lua_objects(lua_State *L)
lua_pop(L, 1);
lua_pushnil(L);
lua_pushinteger(L, rv);
- return 2;
+ lua_pushstring(L, ubus_strerror(rv));
+ return 3;
}
return 1;
@@ -335,7 +337,8 @@ static int ubus_lua_reply(lua_State *L)
{
lua_pushnil(L);
lua_pushinteger(L, UBUS_STATUS_INVALID_ARGUMENT);
- return 2;
+ lua_pushstring(L, ubus_strerror(UBUS_STATUS_INVALID_ARGUMENT));
+ return 3;
}
req = lua_touserdata(L, 2);
@@ -529,7 +532,8 @@ ubus_lua_signatures(lua_State *L)
lua_pop(L, 1);
lua_pushnil(L);
lua_pushinteger(L, rv);
- return 2;
+ lua_pushstring(L, ubus_strerror(rv));
+ return 3;
}
return 1;
@@ -564,7 +568,8 @@ ubus_lua_call(lua_State *L)
{
lua_pushnil(L);
lua_pushinteger(L, UBUS_STATUS_INVALID_ARGUMENT);
- return 2;
+ lua_pushstring(L, ubus_strerror(UBUS_STATUS_INVALID_ARGUMENT));
+ return 3;
}
rv = ubus_lookup_id(c->ctx, path, &id);
@@ -573,7 +578,8 @@ ubus_lua_call(lua_State *L)
{
lua_pushnil(L);
lua_pushinteger(L, rv);
- return 2;
+ lua_pushstring(L, ubus_strerror(rv));
+ return 3;
}
top = lua_gettop(L);
@@ -584,7 +590,8 @@ ubus_lua_call(lua_State *L)
lua_pop(L, 1);
lua_pushnil(L);
lua_pushinteger(L, rv);
- return 2;
+ lua_pushstring(L, ubus_strerror(rv));
+ return 3;
}
return lua_gettop(L) - top;
@@ -669,7 +676,8 @@ ubus_lua_send(lua_State *L)
if (!ubus_lua_format_blob_array(L, &c->buf, true)) {
lua_pushnil(L);
lua_pushinteger(L, UBUS_STATUS_INVALID_ARGUMENT);
- return 2;
+ lua_pushstring(L, ubus_strerror(UBUS_STATUS_INVALID_ARGUMENT));
+ return 3;
}
// Send the event