diff options
author | Steven Barth <steven@midlink.org> | 2008-08-30 15:29:09 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-08-30 15:29:09 +0000 |
commit | 0e05dbb02e68a247f86149cf573b37404882e037 (patch) | |
tree | af56855f5d92b66b2f2853192fb285b1d7fae185 /libs/cbi/luasrc/cbi.lua | |
parent | 1b36a57d3e6cda4d3fc6b02309e1c0077bb0c8f8 (diff) |
libs/cbi: Use :is instead of .code == for UVL error tests
Diffstat (limited to 'libs/cbi/luasrc/cbi.lua')
-rw-r--r-- | libs/cbi/luasrc/cbi.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index 29dd3054f..6ffeca6b0 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -87,18 +87,18 @@ local function _uvl_validate_section(node, name) local stat, err = node.map.validator:validate_section(node.config, name, co) if err then node.map.save = false - if err.code == luci.uvl.errors.ERR_DEPENDENCY then + if err:is(luci.uvl.errors.ERR_DEPENDENCY) then node.tag_deperror[name] = true else node.tag_invalid[name] = true end for i, v in ipairs(err.childs) do if v.option and node.fields[v.option] then - if v.code == luci.uvl.errors.ERR_OPTION then - local subcode = v.childs and v.childs[1] and v.childs[1].code - if subcode == luci.uvl.errors.ERR_DEPENDENCY then + if v:is(luci.uvl.errors.ERR_OPTION) then + local suberr = v.childs and v.childs[1] + if suberr:is(luci.uvl.errors.ERR_DEPENDENCY) then node.fields[v.option].tag_reqerror[name] = true - elseif subcode == luci.uvl.errors.ERR_OPT_REQUIRED then + elseif suberr:is(luci.uvl.errors.ERR_OPT_REQUIRED) then node.fields[v.option].tag_missing[name] = true node.tag_deperror[name] = true else |