diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2008-11-04 16:11:25 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2008-11-04 16:11:25 +0000 |
commit | d1796b2991d347d78cb02d95f09bc4c157b444cc (patch) | |
tree | 53f58d71ab74efc5014d8b1b0f4d7048a54a7c5b | |
parent | 7aee80de5c325d49fe29b6d21b3cb36aa28a2730 (diff) |
* luci/libs/uvl: fix option dependency error handling in case of different non-critical reasons
-rw-r--r-- | libs/uvl/luasrc/uvl.lua | 4 | ||||
-rw-r--r-- | libs/uvl/luasrc/uvl/errors.lua | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/libs/uvl/luasrc/uvl.lua b/libs/uvl/luasrc/uvl.lua index 3963a64be..3b3186eb2 100644 --- a/libs/uvl/luasrc/uvl.lua +++ b/libs/uvl/luasrc/uvl.lua @@ -295,9 +295,7 @@ function UVL._validate_option( self, option, nodeps ) if not nodeps then local ok, err = dependencies.check( self, option ) if not ok then - if not err:is_all(ERR.ERR_DEP_NOTEQUAL) and - not err:is_all(ERR.ERR_DEP_NOVALUE) - then + if not err:is_all(ERR.ERR_DEP_NOTEQUAL,ERR.ERR_DEP_NOVALUE) then option:error(err) return false, option:errors() else diff --git a/libs/uvl/luasrc/uvl/errors.lua b/libs/uvl/luasrc/uvl/errors.lua index 983b61923..a575f4059 100644 --- a/libs/uvl/luasrc/uvl/errors.lua +++ b/libs/uvl/luasrc/uvl/errors.lua @@ -185,13 +185,15 @@ function error.is(self, code) return false end -function error.is_all(self, code) - if self.code == code then +function error.is_all(self, ...) + local codes = { ... } + + if util.contains(codes, self.code) then return true else local equal = false for _, c in ipairs(self.childs) do - equal = ( c.code == code ) + equal = util.contains(codes, c.code) end return equal end |