fix: better error message
This commit is contained in:
parent
c24b0642a7
commit
1a8ad3d06e
2 changed files with 7 additions and 7 deletions
|
|
@ -446,7 +446,7 @@ def manager_callback(
|
|||
or param.raisepropertyerror
|
||||
):
|
||||
raise err from err
|
||||
errors.raise_carry_out_calculation_error(subconfig, _("unable to carry out a calculation for {0}, {1}"), err)
|
||||
raise ConfigError(err)
|
||||
except ValueError as err:
|
||||
display_name = subconfig.option.impl_get_display_name(
|
||||
subconfig, with_quote=True
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ class _CommonError:
|
|||
self.val = val
|
||||
self.display_type = display_type
|
||||
self.opt = weakref.ref(opt)
|
||||
self.name = opt.impl_get_display_name(subconfig)
|
||||
self.name = opt.impl_get_display_name(subconfig, with_quote=True)
|
||||
self.err_msg = err_msg
|
||||
self.index = index
|
||||
super().__init__(self.err_msg)
|
||||
|
|
@ -204,9 +204,9 @@ class ValueWarning(_CommonError, UserWarning):
|
|||
def __init__(self, **kwargs):
|
||||
if ValueWarning.tmpl is None:
|
||||
if kwargs.get('index') is None:
|
||||
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for "{2}"')
|
||||
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for {2}')
|
||||
else:
|
||||
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for "{2}" at index "{3}"')
|
||||
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for {2} at index "{3}"')
|
||||
if list(kwargs) == ['msg']:
|
||||
self.msg = kwargs['msg']
|
||||
else:
|
||||
|
|
@ -225,9 +225,9 @@ class ValueOptionError(_CommonError, ValueError):
|
|||
def __init__(self, **kwargs):
|
||||
if ValueOptionError.tmpl is None:
|
||||
if kwargs.get('index') is None:
|
||||
self.tmpl = _('"{0}" is an invalid {1} for "{2}"')
|
||||
self.tmpl = _('"{0}" is an invalid {1} for {2}')
|
||||
else:
|
||||
self.tmpl = _('"{0}" is an invalid {1} for "{2}" at index "{3}"')
|
||||
self.tmpl = _('"{0}" is an invalid {1} for {2} at index "{3}"')
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ class ValueErrorWarning(ValueWarning):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if ValueErrorWarning.tmpl is None:
|
||||
ValueErrorWarning.tmpl = _('"{0}" is an invalid {1} for "{2}"')
|
||||
ValueErrorWarning.tmpl = _('"{0}" is an invalid {1} for {2}')
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue