summaryrefslogtreecommitdiffhomepage
path: root/libs/uvl/luasrc/uvl.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-08-30 15:15:42 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-08-30 15:15:42 +0000
commit1b36a57d3e6cda4d3fc6b02309e1c0077bb0c8f8 (patch)
treee9b096200d33e7bc825fc1c527cbadb26fd5661d /libs/uvl/luasrc/uvl.lua
parent63706a9f4391a56f7054c496f519e8ec5bebbe1f (diff)
* luci/libs: uvl: added qos and network schemes, fixes in uvl error handling
Diffstat (limited to 'libs/uvl/luasrc/uvl.lua')
-rw-r--r--libs/uvl/luasrc/uvl.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/libs/uvl/luasrc/uvl.lua b/libs/uvl/luasrc/uvl.lua
index 4ff6e7f3c..66e7eeaea 100644
--- a/libs/uvl/luasrc/uvl.lua
+++ b/libs/uvl/luasrc/uvl.lua
@@ -246,7 +246,12 @@ function UVL._validate_section( self, section )
for _, v in ipairs(section:variables()) do
local ok, err = self:_validate_option( v )
- if not ok then
+ if not ok and (
+ v:scheme('required') or v:scheme('type') == "enum" or (
+ not err:is(ERR.ERR_DEP_NOTEQUAL) and
+ not err:is(ERR.ERR_DEP_NOVALUE)
+ )
+ ) then
section:error(err)
end
end
@@ -263,7 +268,7 @@ function UVL._validate_section( self, section )
for k, v in pairs(section:config()) do
local oo = section:option(k)
if k:sub(1,1) ~= "." and not self.beenthere[oo:cid()] then
- section:error(ERR.OPT_NOTFOUND(oo))
+ section:error(ERR.OPT_UNKNOWN(oo))
end
end
end
@@ -292,9 +297,9 @@ function UVL._validate_option( self, option, nodeps )
not option:scheme('values')[val]
then
return false, option:error( ERR.OPT_BADVALUE(
- option, { val, table.concat(
- luci.util.keys(option:scheme('values') or {}), ", "
- ) }
+ option, luci.util.serialize_data(
+ luci.util.keys(option:scheme('values') or {})
+ )
) )
end
elseif option:scheme('type') == "list" then
@@ -309,7 +314,7 @@ function UVL._validate_option( self, option, nodeps )
for i, v in ipairs(val) do
if not self.datatypes[dt]( v ) then
return false, option:error(
- ERR.OPT_INVVALUE(option, {v, dt})
+ ERR.OPT_INVVALUE(option, dt)
)
end
end