mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-24 03:57:28 +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):
|
||||
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
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ class GroupAttribute(Attribute):
|
|||
|
||||
def validateValue(self, value):
|
||||
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
|
||||
|
||||
def retrieveChildrenUids(self):
|
||||
|
@ -87,7 +87,7 @@ class File(Attribute):
|
|||
|
||||
def validateValue(self, value):
|
||||
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('\\', '/')
|
||||
|
||||
|
||||
|
@ -101,7 +101,7 @@ class BoolParam(Param):
|
|||
try:
|
||||
return bool(value)
|
||||
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):
|
||||
|
@ -115,7 +115,7 @@ class IntParam(Param):
|
|||
try:
|
||||
return int(value)
|
||||
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)
|
||||
|
||||
|
@ -131,7 +131,7 @@ class FloatParam(Param):
|
|||
try:
|
||||
return float(value)
|
||||
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)
|
||||
|
||||
|
@ -151,7 +151,7 @@ class ChoiceParam(Param):
|
|||
newValues = [value]
|
||||
else:
|
||||
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
|
||||
for newValue in newValues:
|
||||
if newValue not in self.values:
|
||||
|
@ -171,7 +171,7 @@ class StringParam(Param):
|
|||
|
||||
def validateValue(self, value):
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue