X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-base%2Fluasrc%2Futil.lua;h=ce42af2fb00509779d1ef5feb9c124eb083a91cc;hp=f47d3e53a8bc854b50e75c185e96779fb14b8a03;hb=11f4a50b3f009a665b02564d0ceab133a1772831;hpb=914c661b58fc7e2dede1b9b4f83544b05232065c diff --git a/modules/luci-base/luasrc/util.lua b/modules/luci-base/luasrc/util.lua index f47d3e53a..ce42af2fb 100644 --- a/modules/luci-base/luasrc/util.lua +++ b/modules/luci-base/luasrc/util.lua @@ -631,6 +631,20 @@ function execl(command) return data end + +local ubus_codes = { + "INVALID_COMMAND", + "INVALID_ARGUMENT", + "METHOD_NOT_FOUND", + "NOT_FOUND", + "NO_DATA", + "PERMISSION_DENIED", + "TIMEOUT", + "NOT_SUPPORTED", + "UNKNOWN_ERROR", + "CONNECTION_FAILED" +} + function ubus(object, method, data) if not _ubus_connection then _ubus_connection = _ubus.connect() @@ -641,7 +655,8 @@ function ubus(object, method, data) if type(data) ~= "table" then data = { } end - return _ubus_connection:call(object, method, data) + local rv, err = _ubus_connection:call(object, method, data) + return rv, err, ubus_codes[err] elseif object then return _ubus_connection:signatures(object) else