mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-26 04:57:18 +02:00
[core] desc: use explicit message in validateValue exceptions
This commit is contained in:
parent
cb29e02c0a
commit
848229778e
1 changed files with 8 additions and 8 deletions
|
@ -45,7 +45,7 @@ class ListAttribute(Attribute):
|
||||||
|
|
||||||
def validateValue(self, value):
|
def validateValue(self, value):
|
||||||
if not (isinstance(value, collections.Iterable) and isinstance(value, basestring)):
|
if not (isinstance(value, collections.Iterable) and isinstance(value, basestring)):
|
||||||
raise ValueError('ListAttribute only supports iterable input values.')
|
raise ValueError('ListAttribute only supports iterable input values (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class GroupAttribute(Attribute):
|
||||||
|
|
||||||
def validateValue(self, value):
|
def validateValue(self, value):
|
||||||
if not (isinstance(value, collections.Iterable) and isinstance(value, basestring)):
|
if not (isinstance(value, collections.Iterable) and isinstance(value, basestring)):
|
||||||
raise ValueError('GroupAttribute only supports iterable input values.')
|
raise ValueError('GroupAttribute only supports iterable input values (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def retrieveChildrenUids(self):
|
def retrieveChildrenUids(self):
|
||||||
|
@ -87,7 +87,7 @@ class File(Attribute):
|
||||||
|
|
||||||
def validateValue(self, value):
|
def validateValue(self, value):
|
||||||
if not isinstance(value, basestring):
|
if not isinstance(value, basestring):
|
||||||
raise ValueError('File only supports string input: "{}".'.format(value))
|
raise ValueError('File only supports string input (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
||||||
return os.path.normpath(value).replace('\\', '/')
|
return os.path.normpath(value).replace('\\', '/')
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class BoolParam(Param):
|
||||||
try:
|
try:
|
||||||
return bool(value)
|
return bool(value)
|
||||||
except:
|
except:
|
||||||
raise ValueError('BoolParam only supports bool value.')
|
raise ValueError('BoolParam only supports bool value (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
||||||
|
|
||||||
|
|
||||||
class IntParam(Param):
|
class IntParam(Param):
|
||||||
|
@ -115,7 +115,7 @@ class IntParam(Param):
|
||||||
try:
|
try:
|
||||||
return int(value)
|
return int(value)
|
||||||
except:
|
except:
|
||||||
raise ValueError('IntParam only supports int value.')
|
raise ValueError('IntParam only supports int value (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
||||||
|
|
||||||
range = Property(Variant, lambda self: self._range, constant=True)
|
range = Property(Variant, lambda self: self._range, constant=True)
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class FloatParam(Param):
|
||||||
try:
|
try:
|
||||||
return float(value)
|
return float(value)
|
||||||
except:
|
except:
|
||||||
raise ValueError('FloatParam only supports float value.')
|
raise ValueError('FloatParam only supports float value (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
||||||
|
|
||||||
range = Property(Variant, lambda self: self._range, constant=True)
|
range = Property(Variant, lambda self: self._range, constant=True)
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class ChoiceParam(Param):
|
||||||
newValues = [value]
|
newValues = [value]
|
||||||
else:
|
else:
|
||||||
if not isinstance(value, collections.Iterable):
|
if not isinstance(value, collections.Iterable):
|
||||||
raise ValueError('Non exclusive ChoiceParam value "{}" should be iterable.'.format(value))
|
raise ValueError('Non exclusive ChoiceParam value should be iterable (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
||||||
newValues = value
|
newValues = value
|
||||||
for newValue in newValues:
|
for newValue in newValues:
|
||||||
if newValue not in self.values:
|
if newValue not in self.values:
|
||||||
|
@ -171,7 +171,7 @@ class StringParam(Param):
|
||||||
|
|
||||||
def validateValue(self, value):
|
def validateValue(self, value):
|
||||||
if not isinstance(value, basestring):
|
if not isinstance(value, basestring):
|
||||||
raise ValueError('StringParam value "{}" should be a string.'.format(value))
|
raise ValueError('StringParam value should be a string (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue