Changeset 3702

Show
Ignore:
Timestamp:
11/04/08 17:11:25 (5 years ago)
Author:
jow
Message:

* luci/libs/uvl: fix option dependency error handling in case of different non-critical reasons

Location:
luci/trunk/libs/uvl/luasrc
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/libs/uvl/luasrc/uvl.lua

    r3700 r3702  
    296296            local ok, err = dependencies.check( self, option ) 
    297297            if not ok then 
    298                 if not err:is_all(ERR.ERR_DEP_NOTEQUAL) and 
    299                    not err:is_all(ERR.ERR_DEP_NOVALUE) 
    300                 then 
     298                if not err:is_all(ERR.ERR_DEP_NOTEQUAL,ERR.ERR_DEP_NOVALUE) then 
    301299                    option:error(err) 
    302300                    return false, option:errors() 
  • luci/trunk/libs/uvl/luasrc/uvl/errors.lua

    r3700 r3702  
    186186end 
    187187 
    188 function error.is_all(self, code) 
    189     if self.code == code then 
     188function error.is_all(self, ...) 
     189    local codes = { ... } 
     190 
     191    if util.contains(codes, self.code) then 
    190192        return true 
    191193    else 
    192194        local equal = false 
    193195        for _, c in ipairs(self.childs) do 
    194             equal = ( c.code == code ) 
     196            equal = util.contains(codes, c.code) 
    195197        end 
    196198        return equal