feat: return index in error message

This commit is contained in:
egarette@silique.fr 2025-01-04 17:39:11 +01:00
parent 42471d42b7
commit 4cba819e0a
6 changed files with 104 additions and 87 deletions

View file

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Tiramisu\n" "Project-Id-Version: Tiramisu\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-25 08:23+0100\n" "POT-Creation-Date: 2024-12-15 11:03+0100\n"
"PO-Revision-Date: \n" "PO-Revision-Date: \n"
"Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n" "Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n"
"Language-Team: Tiramisu's team <egarette@cadoles.com>\n" "Language-Team: Tiramisu's team <egarette@cadoles.com>\n"
@ -34,23 +34,23 @@ msgstr "Ne peut avoir de warnings durant une validation"
msgid "Commands:" msgid "Commands:"
msgstr "Commandes :" msgstr "Commandes :"
#: tiramisu/api.py:111 tiramisu/api.py:1840 #: tiramisu/api.py:111 tiramisu/api.py:1843
msgid "please specify a valid sub function ({0}.{1})" msgid "please specify a valid sub function ({0}.{1})"
msgstr "veuillez spécifier une sous fonction valide ({0}.{1})" msgstr "veuillez spécifier une sous fonction valide ({0}.{1})"
#: tiramisu/api.py:194 #: tiramisu/api.py:196
msgid "please do not specify index ({0}.{1})" msgid "please do not specify index ({0}.{1})"
msgstr "veuillez ne pas spécifier d'index ({0}.{1})" msgstr "veuillez ne pas spécifier d'index ({0}.{1})"
#: tiramisu/api.py:199 tiramisu/api.py:844 #: tiramisu/api.py:201 tiramisu/api.py:847
msgid "please specify index with a follower option ({0}.{1})" msgid "please specify index with a follower option ({0}.{1})"
msgstr "veuillez spécifier un index avec une option suiveuse ({0}.{1})" msgstr "veuillez spécifier un index avec une option suiveuse ({0}.{1})"
#: tiramisu/api.py:220 #: tiramisu/api.py:222
msgid "please specify a valid sub function ({0}.{1}): {2}" msgid "please specify a valid sub function ({0}.{1}): {2}"
msgstr "veuillez spécifier une sous fonction valide ({0}.{1}): {2}" msgstr "veuillez spécifier une sous fonction valide ({0}.{1}): {2}"
#: tiramisu/api.py:431 #: tiramisu/api.py:434
msgid "" msgid ""
"the option {0} is not a dynamic option, cannot get identifiers with " "the option {0} is not a dynamic option, cannot get identifiers with "
"only_self parameter to True" "only_self parameter to True"
@ -58,15 +58,15 @@ msgstr ""
"l'option {0} n'est pas une option dynamique, ne peut retrouver l'identifiant " "l'option {0} n'est pas une option dynamique, ne peut retrouver l'identifiant "
"avec le paramètre only_self à True" "avec le paramètre only_self à True"
#: tiramisu/api.py:517 #: tiramisu/api.py:520
msgid "cannot get option from a follower symlink without index" msgid "cannot get option from a follower symlink without index"
msgstr "ne peut avoir d'option pour une symlink suiveuse sans index" msgstr "ne peut avoir d'option pour une symlink suiveuse sans index"
#: tiramisu/api.py:592 #: tiramisu/api.py:595
msgid "cannot add this property: \"{0}\"" msgid "cannot add this property: \"{0}\""
msgstr "ne peut pas ajouter cette propriété : \"{0}\"" msgstr "ne peut pas ajouter cette propriété : \"{0}\""
#: tiramisu/api.py:619 #: tiramisu/api.py:622
msgid "" msgid ""
"cannot remove option's property \"{0}\", use permissive instead in option " "cannot remove option's property \"{0}\", use permissive instead in option "
"\"{1}\"" "\"{1}\""
@ -74,11 +74,11 @@ msgstr ""
"ne supprimer la propriété \"{0}\" de l'option, utiliser plutôt permissive " "ne supprimer la propriété \"{0}\" de l'option, utiliser plutôt permissive "
"dans l'option \"{1}\"" "dans l'option \"{1}\""
#: tiramisu/api.py:623 #: tiramisu/api.py:626
msgid "cannot find \"{0}\" in option \"{1}\"" msgid "cannot find \"{0}\" in option \"{1}\""
msgstr "ne peut trouver \"{0}\" dans l'option \"{1}\"" msgstr "ne peut trouver \"{0}\" dans l'option \"{1}\""
#: tiramisu/api.py:628 #: tiramisu/api.py:631
msgid "" msgid ""
"cannot remove option's property \"{0}\", use permissive instead in option " "cannot remove option's property \"{0}\", use permissive instead in option "
"\"{1}\" at index \"{2}\"" "\"{1}\" at index \"{2}\""
@ -86,39 +86,39 @@ msgstr ""
"ne peut supprimer la propriété \"{0}\" de l'option, utilisez plutôt " "ne peut supprimer la propriété \"{0}\" de l'option, utilisez plutôt "
"permissive dans l'option \"{1}\" a l'index \"{2}\"" "permissive dans l'option \"{1}\" a l'index \"{2}\""
#: tiramisu/api.py:632 #: tiramisu/api.py:635
msgid "cannot find \"{0}\" in option \"{1}\" at index \"{2}\"" msgid "cannot find \"{0}\" in option \"{1}\" at index \"{2}\""
msgstr "ne peut trouver \"{0}\" dans l'option \"{1}\" à l'index \"{2}\"" msgstr "ne peut trouver \"{0}\" dans l'option \"{1}\" à l'index \"{2}\""
#: tiramisu/api.py:676 #: tiramisu/api.py:679
msgid "cannot find \"{0}\"" msgid "cannot find \"{0}\""
msgstr "ne peut trouver \"{0}\"" msgstr "ne peut trouver \"{0}\""
#: tiramisu/api.py:808 #: tiramisu/api.py:811
msgid "cannot reduce length of the leader {}" msgid "cannot reduce length of the leader {}"
msgstr "il est impossible de réduire la longueur du leader \"{}\"" msgstr "il est impossible de réduire la longueur du leader \"{}\""
#: tiramisu/api.py:861 #: tiramisu/api.py:864
msgid "only multi value has defaultmulti" msgid "only multi value has defaultmulti"
msgstr "seule les valeurs multiple a l'attribut defaultmulti" msgstr "seule les valeurs multiple a l'attribut defaultmulti"
#: tiramisu/api.py:1020 #: tiramisu/api.py:1023
msgid "please specify a valid sub function ({0}.{1}) for {2}" msgid "please specify a valid sub function ({0}.{1}) for {2}"
msgstr "veuillez spécifier une sous fonction valide ({0}.{1}) pour {2}" msgstr "veuillez spécifier une sous fonction valide ({0}.{1}) pour {2}"
#: tiramisu/api.py:1407 #: tiramisu/api.py:1410
msgid "properties must be a frozenset" msgid "properties must be a frozenset"
msgstr "une propriété doit être de type frozenset" msgstr "une propriété doit être de type frozenset"
#: tiramisu/api.py:1411 tiramisu/api.py:1438 #: tiramisu/api.py:1414 tiramisu/api.py:1441
msgid "unknown when {} (must be in append or remove)" msgid "unknown when {} (must be in append or remove)"
msgstr "value {} inconsistent (doit être append ou remove)" msgstr "value {} inconsistent (doit être append ou remove)"
#: tiramisu/api.py:1424 tiramisu/api.py:1448 tiramisu/config.py:1681 #: tiramisu/api.py:1427 tiramisu/api.py:1451 tiramisu/config.py:1681
msgid "unknown type {}" msgid "unknown type {}"
msgstr "type inconnu {}" msgstr "type inconnu {}"
#: tiramisu/api.py:1812 #: tiramisu/api.py:1815
msgid "do not use unrestraint, nowarnings or forcepermissive together" msgid "do not use unrestraint, nowarnings or forcepermissive together"
msgstr "" msgstr ""
"il ne faut pas utiliser unrestraint, nowarnings ou forcepermissive ensemble" "il ne faut pas utiliser unrestraint, nowarnings ou forcepermissive ensemble"
@ -205,14 +205,14 @@ msgstr ""
"l'option {0} n'est pas une dynoptiondescription ou n'est pas dans une " "l'option {0} n'est pas une dynoptiondescription ou n'est pas dans une "
"dynoptiondescription" "dynoptiondescription"
#: tiramisu/autolib.py:682 #: tiramisu/autolib.py:685
msgid "" msgid ""
"cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\"" "cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\""
msgstr "" msgstr ""
"impossible de calculer les arguments de \"{0}\", la variable dynamic \"{1}\" " "impossible de calculer les arguments de \"{0}\", la variable dynamic \"{1}\" "
"ne peut être trouvée" "ne peut être trouvée"
#: tiramisu/autolib.py:861 #: tiramisu/autolib.py:864
msgid "" msgid ""
"the \"{}\" function with positional arguments \"{}\" and keyword arguments " "the \"{}\" function with positional arguments \"{}\" and keyword arguments "
"\"{}\" must not return a list (\"{}\") for the follower option {}" "\"{}\" must not return a list (\"{}\") for the follower option {}"
@ -221,7 +221,7 @@ msgstr ""
"nommés \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option " "nommés \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option "
"suiveuse {}" "suiveuse {}"
#: tiramisu/autolib.py:876 #: tiramisu/autolib.py:879
msgid "" msgid ""
"the \"{}\" function must not return a list (\"{}\") for the follower option " "the \"{}\" function must not return a list (\"{}\") for the follower option "
"{}" "{}"
@ -229,7 +229,7 @@ msgstr ""
"la fonction \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option " "la fonction \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option "
"suiveuse {}" "suiveuse {}"
#: tiramisu/autolib.py:917 #: tiramisu/autolib.py:920
msgid "" msgid ""
"unexpected error \"{0}\" in function \"{1}\" with arguments \"{3}\" and " "unexpected error \"{0}\" in function \"{1}\" with arguments \"{3}\" and "
"\"{4}\" for option {2}" "\"{4}\" for option {2}"
@ -237,7 +237,7 @@ msgstr ""
"erreur inattendue \"{0}\" dans la fonction \"{1}\" avec les arguments " "erreur inattendue \"{0}\" dans la fonction \"{1}\" avec les arguments "
"\"{3}\" et \"{4}\" pour l'option {2}" "\"{3}\" et \"{4}\" pour l'option {2}"
#: tiramisu/autolib.py:928 #: tiramisu/autolib.py:931
msgid "unexpected error \"{0}\" in function \"{1}\" for option {2}" msgid "unexpected error \"{0}\" in function \"{1}\" for option {2}"
msgstr "erreur inattendue \"{0}\" dans la fonction \"{1}\" pour l'option {2}" msgstr "erreur inattendue \"{0}\" dans la fonction \"{1}\" pour l'option {2}"
@ -603,9 +603,17 @@ msgstr ""
msgid "must starts with \"/\"" msgid "must starts with \"/\""
msgstr "doit débuter par \"/\"" msgstr "doit débuter par \"/\""
#: tiramisu/option/filenameoption.py:78 #: tiramisu/option/filenameoption.py:77
msgid "cannot find {0} \"{1}\"" msgid "directory"
msgstr "ne peut pas trouver {0} \"{1}\"" msgstr "répertoire"
#: tiramisu/option/filenameoption.py:77
msgid "file"
msgstr "fichier"
#: tiramisu/option/filenameoption.py:79
msgid "cannot find this {0}"
msgstr "ce {0} est introuvable"
#: tiramisu/option/intoption.py:52 #: tiramisu/option/intoption.py:52
msgid "value should be equal or greater than \"{0}\"" msgid "value should be equal or greater than \"{0}\""
@ -961,6 +969,9 @@ msgstr ""
msgid "information's item not found \"{}\"" msgid "information's item not found \"{}\""
msgstr "l'information de l'objet ne sont pas trouvé \"{}\"" msgstr "l'information de l'objet ne sont pas trouvé \"{}\""
#~ msgid "cannot find {0} \"{1}\""
#~ msgstr "ne peut pas trouver {0} \"{1}\""
#~ msgid "" #~ msgid ""
#~ "IP \"{ip[\"value\"]}\" ({ip[\"name\"]}) with this netmask is in fact a " #~ "IP \"{ip[\"value\"]}\" ({ip[\"name\"]}) with this netmask is in fact a "
#~ "broacast address" #~ "broacast address"
@ -1140,9 +1151,6 @@ msgstr "l'information de l'objet ne sont pas trouvé \"{}\""
#~ msgid "email address" #~ msgid "email address"
#~ msgstr "adresse mail" #~ msgstr "adresse mail"
#~ msgid "file name"
#~ msgstr "nom de fichier"
#~ msgid "float" #~ msgid "float"
#~ msgstr "nombre flottant" #~ msgstr "nombre flottant"

View file

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-11-25 08:29+0100\n" "POT-Creation-Date: 2024-12-15 11:06+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -35,79 +35,79 @@ msgstr ""
msgid "Commands:" msgid "Commands:"
msgstr "" msgstr ""
#: tiramisu/api.py:111 tiramisu/api.py:1840 #: tiramisu/api.py:111 tiramisu/api.py:1843
msgid "please specify a valid sub function ({0}.{1})" msgid "please specify a valid sub function ({0}.{1})"
msgstr "" msgstr ""
#: tiramisu/api.py:194 #: tiramisu/api.py:196
msgid "please do not specify index ({0}.{1})" msgid "please do not specify index ({0}.{1})"
msgstr "" msgstr ""
#: tiramisu/api.py:199 tiramisu/api.py:844 #: tiramisu/api.py:201 tiramisu/api.py:847
msgid "please specify index with a follower option ({0}.{1})" msgid "please specify index with a follower option ({0}.{1})"
msgstr "" msgstr ""
#: tiramisu/api.py:220 #: tiramisu/api.py:222
msgid "please specify a valid sub function ({0}.{1}): {2}" msgid "please specify a valid sub function ({0}.{1}): {2}"
msgstr "" msgstr ""
#: tiramisu/api.py:431 #: tiramisu/api.py:434
msgid "the option {0} is not a dynamic option, cannot get identifiers with only_self parameter to True" msgid "the option {0} is not a dynamic option, cannot get identifiers with only_self parameter to True"
msgstr "" msgstr ""
#: tiramisu/api.py:517 #: tiramisu/api.py:520
msgid "cannot get option from a follower symlink without index" msgid "cannot get option from a follower symlink without index"
msgstr "" msgstr ""
#: tiramisu/api.py:592 #: tiramisu/api.py:595
msgid "cannot add this property: \"{0}\"" msgid "cannot add this property: \"{0}\""
msgstr "" msgstr ""
#: tiramisu/api.py:619 #: tiramisu/api.py:622
msgid "cannot remove option's property \"{0}\", use permissive instead in option \"{1}\"" msgid "cannot remove option's property \"{0}\", use permissive instead in option \"{1}\""
msgstr "" msgstr ""
#: tiramisu/api.py:623 #: tiramisu/api.py:626
msgid "cannot find \"{0}\" in option \"{1}\"" msgid "cannot find \"{0}\" in option \"{1}\""
msgstr "" msgstr ""
#: tiramisu/api.py:628 #: tiramisu/api.py:631
msgid "cannot remove option's property \"{0}\", use permissive instead in option \"{1}\" at index \"{2}\"" msgid "cannot remove option's property \"{0}\", use permissive instead in option \"{1}\" at index \"{2}\""
msgstr "" msgstr ""
#: tiramisu/api.py:632 #: tiramisu/api.py:635
msgid "cannot find \"{0}\" in option \"{1}\" at index \"{2}\"" msgid "cannot find \"{0}\" in option \"{1}\" at index \"{2}\""
msgstr "" msgstr ""
#: tiramisu/api.py:676 #: tiramisu/api.py:679
msgid "cannot find \"{0}\"" msgid "cannot find \"{0}\""
msgstr "" msgstr ""
#: tiramisu/api.py:808 #: tiramisu/api.py:811
msgid "cannot reduce length of the leader {}" msgid "cannot reduce length of the leader {}"
msgstr "" msgstr ""
#: tiramisu/api.py:861 #: tiramisu/api.py:864
msgid "only multi value has defaultmulti" msgid "only multi value has defaultmulti"
msgstr "" msgstr ""
#: tiramisu/api.py:1020 #: tiramisu/api.py:1023
msgid "please specify a valid sub function ({0}.{1}) for {2}" msgid "please specify a valid sub function ({0}.{1}) for {2}"
msgstr "" msgstr ""
#: tiramisu/api.py:1407 #: tiramisu/api.py:1410
msgid "properties must be a frozenset" msgid "properties must be a frozenset"
msgstr "" msgstr ""
#: tiramisu/api.py:1411 tiramisu/api.py:1438 #: tiramisu/api.py:1414 tiramisu/api.py:1441
msgid "unknown when {} (must be in append or remove)" msgid "unknown when {} (must be in append or remove)"
msgstr "" msgstr ""
#: tiramisu/api.py:1424 tiramisu/api.py:1448 tiramisu/config.py:1681 #: tiramisu/api.py:1427 tiramisu/api.py:1451 tiramisu/config.py:1681
msgid "unknown type {}" msgid "unknown type {}"
msgstr "" msgstr ""
#: tiramisu/api.py:1812 #: tiramisu/api.py:1815
msgid "do not use unrestraint, nowarnings or forcepermissive together" msgid "do not use unrestraint, nowarnings or forcepermissive together"
msgstr "" msgstr ""
@ -187,23 +187,23 @@ msgstr ""
msgid "option {0} is not a dynoptiondescription or in a dynoptiondescription" msgid "option {0} is not a dynoptiondescription or in a dynoptiondescription"
msgstr "" msgstr ""
#: tiramisu/autolib.py:682 #: tiramisu/autolib.py:685
msgid "cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\"" msgid "cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\""
msgstr "" msgstr ""
#: tiramisu/autolib.py:861 #: tiramisu/autolib.py:864
msgid "the \"{}\" function with positional arguments \"{}\" and keyword arguments \"{}\" must not return a list (\"{}\") for the follower option {}" msgid "the \"{}\" function with positional arguments \"{}\" and keyword arguments \"{}\" must not return a list (\"{}\") for the follower option {}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:876 #: tiramisu/autolib.py:879
msgid "the \"{}\" function must not return a list (\"{}\") for the follower option {}" msgid "the \"{}\" function must not return a list (\"{}\") for the follower option {}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:917 #: tiramisu/autolib.py:920
msgid "unexpected error \"{0}\" in function \"{1}\" with arguments \"{3}\" and \"{4}\" for option {2}" msgid "unexpected error \"{0}\" in function \"{1}\" with arguments \"{3}\" and \"{4}\" for option {2}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:928 #: tiramisu/autolib.py:931
msgid "unexpected error \"{0}\" in function \"{1}\" for option {2}" msgid "unexpected error \"{0}\" in function \"{1}\" for option {2}"
msgstr "" msgstr ""
@ -520,8 +520,16 @@ msgstr ""
msgid "must starts with \"/\"" msgid "must starts with \"/\""
msgstr "" msgstr ""
#: tiramisu/option/filenameoption.py:78 #: tiramisu/option/filenameoption.py:77
msgid "cannot find {0} \"{1}\"" msgid "directory"
msgstr ""
#: tiramisu/option/filenameoption.py:77
msgid "file"
msgstr ""
#: tiramisu/option/filenameoption.py:79
msgid "cannot find this {0}"
msgstr "" msgstr ""
#: tiramisu/option/intoption.py:52 #: tiramisu/option/intoption.py:52

View file

@ -909,7 +909,7 @@ def calculate(
except (ValueError, ValueWarning) as err: except (ValueError, ValueWarning) as err:
if allow_value_error: if allow_value_error:
if force_value_warning: if force_value_warning:
raise ValueWarning(str(err)) raise ValueWarning(msg=str(err))
raise err from err raise err from err
error = err error = err
except ConfigError as err: except ConfigError as err:

View file

@ -181,7 +181,7 @@ class _CommonError:
try: try:
msg = self.prefix msg = self.prefix
except AttributeError: except AttributeError:
self.prefix = self.tmpl.format(self.val, _(self.display_type), self.name) self.prefix = self.tmpl.format(self.val, _(self.display_type), self.name, self.index)
msg = self.prefix msg = self.prefix
if self.err_msg: if self.err_msg:
if msg: if msg:
@ -196,13 +196,16 @@ class _CommonError:
class ValueWarning(_CommonError, UserWarning): class ValueWarning(_CommonError, UserWarning):
tmpl = None tmpl = None
def __init__(self, *args, **kwargs): def __init__(self, **kwargs):
if ValueWarning.tmpl is None: if ValueWarning.tmpl is None:
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for "{2}"') if kwargs.get('index') is None:
if len(args) == 1 and not kwargs: ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for "{2}"')
self.msg = args[0] else:
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for "{2}" at index "{3}"')
if list(kwargs) == ['msg']:
self.msg = kwargs['msg']
else: else:
super().__init__(*args, **kwargs) super().__init__(**kwargs)
self.msg = None self.msg = None
def __str__(self): def __str__(self):
@ -214,10 +217,13 @@ class ValueWarning(_CommonError, UserWarning):
class ValueOptionError(_CommonError, ValueError): class ValueOptionError(_CommonError, ValueError):
tmpl = None tmpl = None
def __init__(self, *args, **kwargs): def __init__(self, **kwargs):
if ValueOptionError.tmpl is None: if ValueOptionError.tmpl is None:
ValueOptionError.tmpl = _('"{0}" is an invalid {1} for "{2}"') if kwargs.get('index') is None:
super().__init__(*args, **kwargs) ValueOptionError.tmpl = _('"{0}" is an invalid {1} for "{2}"')
else:
ValueOptionError.tmpl = _('"{0}" is an invalid {1} for "{2}" at index "{3}"')
super().__init__(**kwargs)
class ValueErrorWarning(ValueWarning): class ValueErrorWarning(ValueWarning):

View file

@ -127,11 +127,6 @@ class Option(BaseOption):
def test_multi_value(value): def test_multi_value(value):
if isinstance(value, Calculation): if isinstance(value, Calculation):
return return
# option_bag = OptionBag(self,
# None,
# undefined,
# properties=None,
# )
try: try:
self.validate(value) self.validate(value)
self.validate_with_option( self.validate_with_option(
@ -329,12 +324,12 @@ class Option(BaseOption):
except ValueWarning as warn: except ValueWarning as warn:
warnings.warn_explicit( warnings.warn_explicit(
ValueWarning( ValueWarning(
subconfig, subconfig=subconfig,
val, val=val,
_(self.get_type()), display_type=_(self.get_type()),
self, opt=self,
str(warn), err_msg=str(warn),
_index, index=_index,
), ),
ValueWarning, ValueWarning,
self.__class__.__name__, self.__class__.__name__,
@ -370,12 +365,12 @@ class Option(BaseOption):
if is_warnings_only: if is_warnings_only:
warnings.warn_explicit( warnings.warn_explicit(
ValueWarning( ValueWarning(
subconfig, subconfig=subconfig,
_value, val=_value,
_(self.get_type()), display_type=_(self.get_type()),
self, opt=self,
str(err), err_msg=str(err),
_index, index=_index,
), ),
ValueWarning, ValueWarning,
self.__class__.__name__, self.__class__.__name__,
@ -442,11 +437,11 @@ class Option(BaseOption):
or "demoting_error_warning" not in subconfig.config_bag.properties or "demoting_error_warning" not in subconfig.config_bag.properties
): ):
raise ValueOptionError( raise ValueOptionError(
subconfig, val, _(self.get_type()), self, str(err), err_index subconfig=subconfig, val=val, display_type=_(self.get_type()), opt=self, err_msg=str(err), index=err_index
) from err ) from err
warnings.warn_explicit( warnings.warn_explicit(
ValueErrorWarning( ValueErrorWarning(
subconfig, val, _(self.get_type()), self, str(err), err_index subconfig=subconfig, val=val, display_type=_(self.get_type()), opt=self, err_msg=str(err), index=err_index
), ),
ValueErrorWarning, ValueErrorWarning,
self.__class__.__name__, self.__class__.__name__,