add SlaveError for slave's length

This commit is contained in:
Emmanuel Garette 2013-04-19 20:10:55 +02:00
parent e08bd93cd8
commit 410add6a2a
2 changed files with 20 additions and 12 deletions

View File

@ -29,11 +29,20 @@
#AttributeError if no option or optiondescription in optiondescription (also when specified a path)
#____________option___________
class PropertiesOptionError(AttributeError):
"try to access to opt with not allowed property"
def __init__(self, msg, proptype):
self.proptype = proptype
super(PropertiesOptionError, self).__init__(msg)
class ConflictOptionError(StandardError):
"more than one option"
pass
#____________config___________
class ConfigError(StandardError):
"""try to change owner for an option without value
or if error in calculation"""
@ -45,13 +54,12 @@ class ConflictConfigError(ConfigError):
pass
class PropertiesOptionError(AttributeError):
"try to access to opt with not allowed property"
def __init__(self, msg, proptype):
self.proptype = proptype
super(PropertiesOptionError, self).__init__(msg)
#____________other___________
class RequirementRecursionError(StandardError):
"recursive error"
pass
class SlaveError(StandardError):
"problem with slave's length"
pass

View File

@ -18,7 +18,7 @@
#
# ____________________________________________________________
from time import time
from tiramisu.error import ConfigError
from tiramisu.error import ConfigError, SlaveError
from tiramisu.setting import owners, multitypes, expires_time
from tiramisu.autolib import carry_out_calculation
from tiramisu.i18n import _
@ -214,7 +214,7 @@ class Multi(list):
masterlen = len(mastervalue)
if len(value) > masterlen or (len(value) < masterlen and
not self.context.cfgimpl_get_values().is_default_owner(self.opt)):
raise ValueError(_("invalid len for the slave: {0}"
raise SlaveError(_("invalid len for the slave: {0}"
" which has {1} as master").format(
self.opt._name, masterp))
elif len(value) < masterlen:
@ -230,7 +230,7 @@ class Multi(list):
if not values.is_default_owner(slave):
value_slave = values._get_value(slave)
if len(value_slave) > masterlen:
raise ValueError(_("invalid len for the master: {0}"
raise SlaveError(_("invalid len for the master: {0}"
" which has {1} as slave with"
" greater len").format(
self.opt._name, slave._name))
@ -250,7 +250,7 @@ class Multi(list):
"""
if not force:
if self.opt.get_multitype() == multitypes.slave:
raise ValueError(_("cannot append a value on a multi option {0}"
raise SlaveError(_("cannot append a value on a multi option {0}"
" which is a slave").format(self.opt._name))
elif self.opt.get_multitype() == multitypes.master:
for slave in self.opt.get_master_slaves():
@ -278,7 +278,7 @@ class Multi(list):
"""
if not force:
if self.opt.get_multitype() == multitypes.slave:
raise ValueError(_("cannot pop a value on a multi option {0}"
raise SlaveError(_("cannot pop a value on a multi option {0}"
" which is a slave").format(self.opt._name))
elif self.opt.get_multitype() == multitypes.master:
for slave in self.opt.get_master_slaves():