fix: better error message

This commit is contained in:
egarette@silique.fr 2025-12-23 20:42:10 +01:00
parent 018634a5e8
commit bb79bbba17
4 changed files with 83 additions and 60 deletions

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-12-22 19:02+0100\n"
"PO-Revision-Date: 2025-12-22 19:04+0100\n"
"POT-Creation-Date: 2025-12-23 21:09+0100\n"
"PO-Revision-Date: 2025-12-23 21:10+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -644,7 +644,7 @@ msgid "internal error, {0} is not a dynamic variable"
msgstr "erreur interne, \"{0}\" n'est pas une variable dynamique"
#: src/rougail/error.py:61 src/rougail/tiramisu.py:235
#: src/rougail/user_data.py:452 src/rougail/user_data.py:455
#: src/rougail/user_data.py:463 src/rougail/user_data.py:466
msgid "{0} in {1}"
msgstr "{0} dans {1}"
@ -889,30 +889,38 @@ msgstr "\"{0}\" est un {1} invalide"
msgid "the attribute \"{0}\" in {1} causes the error: {2}"
msgstr "l'attribut \"{0}\" dans {1} provoque l'erreur : {2}"
#: src/rougail/user_data.py:146
#: src/rougail/user_data.py:101
msgid "{0}"
msgstr ""
#: src/rougail/user_data.py:103
msgid "{0}, it will be ignored"
msgstr "{0}, elle sera ignorée"
#: src/rougail/user_data.py:154
msgid ""
"cannot load variable path \"{0}\", the identifier \"{1}\" is not valid in {2}"
msgstr ""
"ne peut charger la variable \"{0}\", l'identifiant \"{1}\" n'est pas valide "
"dans {2}"
#: src/rougail/user_data.py:230
#: src/rougail/user_data.py:238
msgid "the variable contains secrets and should not be defined in {0}"
msgstr ""
"la variable contient des secrets et ne devrait pas être défini dans {0}"
#: src/rougail/user_data.py:269
#: src/rougail/user_data.py:277
msgid "loaded from {0}"
msgstr "chargée depuis {0}"
#: src/rougail/user_data.py:311
#: src/rougail/user_data.py:317
msgid ""
"is a family so we cannot set the value \"{0}\", it has been loading from {1}"
msgstr ""
"est une famille donc il n'est pas possible de définir la valeur \"{0}\", "
"elle a été chargée depuis {1}"
#: src/rougail/user_data.py:315
#: src/rougail/user_data.py:321
msgid ""
"is a family so we cannot set the value \"{0}\", it will be ignored when "
"loading from {1}"
@ -920,16 +928,16 @@ msgstr ""
"est une famille donc il n'est pas possible de définir la valeur \"{0}\", "
"elle sera ignorée lors du chargement depuis {1}"
#: src/rougail/user_data.py:326
#: src/rougail/user_data.py:332 src/rougail/user_data.py:337
msgid "{0}, it has been loaded from {1}"
msgstr "{0}, elle a été chargée depuis {1}"
#: src/rougail/user_data.py:332
#: src/rougail/user_data.py:343
msgid "variable or family \"{0}\" does not exist, it has been loading from {1}"
msgstr ""
"la variable ou la famille \"{0}\" n'existe pas, elle a été chargée depuis {1}"
#: src/rougail/user_data.py:336
#: src/rougail/user_data.py:347
msgid ""
"variable or family \"{0}\" does not exist, it will be ignored when loading "
"from {1}"
@ -937,12 +945,12 @@ msgstr ""
"la variable ou la famille \"{0}\" n'existe pas, elle sera ignorée lors du "
"chargement depuis {1}"
#: src/rougail/user_data.py:342
#: src/rougail/user_data.py:353
msgid "\"{0}\" is the name of a dynamic family, it has been loading from {1}"
msgstr ""
"\"{0}\" est le nom d'une famille dynamique, elle a été chargée depuis {1}"
#: src/rougail/user_data.py:346
#: src/rougail/user_data.py:357
msgid ""
"\"{0}\" is the name of a dynamic family, it will be ignored when loading "
"from {1}"
@ -950,16 +958,16 @@ msgstr ""
"\"{0}\" est le nom d'une famille dynamique, il sera ignoré lors du "
"chargement depuis {1}"
#: src/rougail/user_data.py:354
#: src/rougail/user_data.py:365
msgid "{0} loaded from {1}"
msgstr "{0} chargée depuis {1}"
#: src/rougail/user_data.py:385
#: src/rougail/user_data.py:396
msgid "variable {0} at index \"{1}\" is {2}, it has been loading from {3}"
msgstr ""
"la variable {0} à l'index \"{1}\" est {2}, elle a été chargée depuis {3}"
#: src/rougail/user_data.py:389
#: src/rougail/user_data.py:400
msgid ""
"variable {0} at index \"{1}\" is {2}, it will be ignored when loading from "
"{3}"
@ -967,29 +975,29 @@ msgstr ""
"la variable {0} à l'index \"{1}\" est {2}, elle sera ignorée lors du "
"chargement depuis {3}"
#: src/rougail/user_data.py:402
#: src/rougail/user_data.py:413
msgid "family {0} is {1}, {2} at index \"{3}\", it has been loading from {4}"
msgstr ""
"la famille {0} est {1}, {2} à l'index \"{3}\", elle a été chargée depuis {4}"
#: src/rougail/user_data.py:406
#: src/rougail/user_data.py:417
msgid ""
"family {0} is {1}, {2} at index \"{3}\", it will be ignored when loading "
"from {4}"
msgstr ""
"la famille {0} est {1}, {2} à l'index \"{3}\", elle a été chargée depuis {4}"
#: src/rougail/user_data.py:421
#: src/rougail/user_data.py:432
msgid "variable has propery {0}, it has been loading from {1}"
msgstr "la variable a la propriété {0}, elle a été chargée depuis {1}"
#: src/rougail/user_data.py:425
#: src/rougail/user_data.py:436
msgid "variable has property {0}, it will be ignored when loading from {1}"
msgstr ""
"la variable a la propriété {0}, elle sera ignorée lors du chargement depuis "
"{1}"
#: src/rougail/user_data.py:435
#: src/rougail/user_data.py:446
msgid ""
"family {0} has property {1}, so cannot access to {2}, it has been loading "
"from {3}"
@ -997,7 +1005,7 @@ msgstr ""
"la famille {0} a la propriété {1}, donc ne peut accéder à {2}, elle a été "
"chargée depuis {3}"
#: src/rougail/user_data.py:439
#: src/rougail/user_data.py:450
msgid ""
"family {0} has property {1}, so cannot access to {2}, it will be ignored "
"when loading from {3}"
@ -1005,23 +1013,23 @@ msgstr ""
"la famille {0} a la propriété {1}, donc ne peut accéder à {2}, sera ignorée "
"lors du chargement depuis {3}"
#: src/rougail/user_data.py:459
#: src/rougail/user_data.py:470
msgid "{0}, it has been loading from {1}"
msgstr "{0}, elle a été chargée depuis {1}"
#: src/rougail/user_data.py:461
#: src/rougail/user_data.py:472
msgid "{0}, it will be ignored when loading from {1}"
msgstr "{0}, elle sera ignorée lors du chargement depuis {1}"
#: src/rougail/user_data.py:466
#: src/rougail/user_data.py:477
msgid "the value \"{0}\" is an invalid {1}, {2}"
msgstr "la valeur \"{0}\" est un {1} invalide, {2}"
#: src/rougail/user_data.py:472
#: src/rougail/user_data.py:483
msgid ", it has been loading from {0}"
msgstr ", elle a été chargée depuis {0}"
#: src/rougail/user_data.py:474
#: src/rougail/user_data.py:485
msgid ", it will be ignored when loading from {0}"
msgstr ", elle sera ignorée lors du chargement depuis {0}"

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-12-22 19:04+0100\n"
"POT-Creation-Date: 2025-12-23 21:10+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -438,7 +438,7 @@ msgid "internal error, {0} is not a dynamic variable"
msgstr ""
#: src/rougail/error.py:61 src/rougail/tiramisu.py:235
#: src/rougail/user_data.py:452 src/rougail/user_data.py:455
#: src/rougail/user_data.py:463 src/rougail/user_data.py:466
msgid "{0} in {1}"
msgstr ""
@ -671,99 +671,103 @@ msgstr ""
msgid "the attribute \"{0}\" in {1} causes the error: {2}"
msgstr ""
#: src/rougail/user_data.py:146
#: src/rougail/user_data.py:103
msgid "{0}, it will be ignored"
msgstr ""
#: src/rougail/user_data.py:154
msgid "cannot load variable path \"{0}\", the identifier \"{1}\" is not valid in {2}"
msgstr ""
#: src/rougail/user_data.py:230
#: src/rougail/user_data.py:238
msgid "the variable contains secrets and should not be defined in {0}"
msgstr ""
#: src/rougail/user_data.py:269
#: src/rougail/user_data.py:277
msgid "loaded from {0}"
msgstr ""
#: src/rougail/user_data.py:311
#: src/rougail/user_data.py:317
msgid "is a family so we cannot set the value \"{0}\", it has been loading from {1}"
msgstr ""
#: src/rougail/user_data.py:315
#: src/rougail/user_data.py:321
msgid "is a family so we cannot set the value \"{0}\", it will be ignored when loading from {1}"
msgstr ""
#: src/rougail/user_data.py:326
#: src/rougail/user_data.py:332 src/rougail/user_data.py:337
msgid "{0}, it has been loaded from {1}"
msgstr ""
#: src/rougail/user_data.py:332
#: src/rougail/user_data.py:343
msgid "variable or family \"{0}\" does not exist, it has been loading from {1}"
msgstr ""
#: src/rougail/user_data.py:336
#: src/rougail/user_data.py:347
msgid "variable or family \"{0}\" does not exist, it will be ignored when loading from {1}"
msgstr ""
#: src/rougail/user_data.py:342
#: src/rougail/user_data.py:353
msgid "\"{0}\" is the name of a dynamic family, it has been loading from {1}"
msgstr ""
#: src/rougail/user_data.py:346
#: src/rougail/user_data.py:357
msgid "\"{0}\" is the name of a dynamic family, it will be ignored when loading from {1}"
msgstr ""
#: src/rougail/user_data.py:354
#: src/rougail/user_data.py:365
msgid "{0} loaded from {1}"
msgstr ""
#: src/rougail/user_data.py:385
#: src/rougail/user_data.py:396
msgid "variable {0} at index \"{1}\" is {2}, it has been loading from {3}"
msgstr ""
#: src/rougail/user_data.py:389
#: src/rougail/user_data.py:400
msgid "variable {0} at index \"{1}\" is {2}, it will be ignored when loading from {3}"
msgstr ""
#: src/rougail/user_data.py:402
#: src/rougail/user_data.py:413
msgid "family {0} is {1}, {2} at index \"{3}\", it has been loading from {4}"
msgstr ""
#: src/rougail/user_data.py:406
#: src/rougail/user_data.py:417
msgid "family {0} is {1}, {2} at index \"{3}\", it will be ignored when loading from {4}"
msgstr ""
#: src/rougail/user_data.py:421
#: src/rougail/user_data.py:432
msgid "variable has propery {0}, it has been loading from {1}"
msgstr ""
#: src/rougail/user_data.py:425
#: src/rougail/user_data.py:436
msgid "variable has property {0}, it will be ignored when loading from {1}"
msgstr ""
#: src/rougail/user_data.py:435
#: src/rougail/user_data.py:446
msgid "family {0} has property {1}, so cannot access to {2}, it has been loading from {3}"
msgstr ""
#: src/rougail/user_data.py:439
#: src/rougail/user_data.py:450
msgid "family {0} has property {1}, so cannot access to {2}, it will be ignored when loading from {3}"
msgstr ""
#: src/rougail/user_data.py:459
#: src/rougail/user_data.py:470
msgid "{0}, it has been loading from {1}"
msgstr ""
#: src/rougail/user_data.py:461
#: src/rougail/user_data.py:472
msgid "{0}, it will be ignored when loading from {1}"
msgstr ""
#: src/rougail/user_data.py:466
#: src/rougail/user_data.py:477
msgid "the value \"{0}\" is an invalid {1}, {2}"
msgstr ""
#: src/rougail/user_data.py:472
#: src/rougail/user_data.py:483
msgid ", it has been loading from {0}"
msgstr ""
#: src/rougail/user_data.py:474
#: src/rougail/user_data.py:485
msgid ", it will be ignored when loading from {0}"
msgstr ""

View file

@ -89,11 +89,19 @@ class UserData:
self.warnings.extend(datas.get("warnings", []))
def _get_variable(self, config):
try:
for subconfig in config:
if subconfig.isoptiondescription():
yield from self._get_variable(subconfig)
else:
yield subconfig
except (ConfigError, ValueError) as err:
err.prefix = ""
if self.invalid_user_data_error:
msg = str(err)
else:
msg = _('{0}, it will be ignored').format(err)
self.invalids.append({msg: err.subconfig})
def _auto_configure_dynamics(self):
cache = {}
@ -297,8 +305,6 @@ class UserData:
def _populate_error_warnings(self):
# we don't find variable, apply value just to get error or warning messages
for path, options in self.values.items():
# if "{{ identifier }}" in path:
# continue
value = options["values"]
if options.get("secret_manager"):
option = self.config.forcepermissive.option(path)
@ -321,7 +327,12 @@ class UserData:
): option._subconfig}
)
continue
except (ConfigError, PropertiesOptionError) as err:
except ConfigError as err:
self.invalids.append({
_("{0}, it has been loaded from {1}").format(err, options["source"]): option._subconfig}
)
continue
except PropertiesOptionError as err:
self.unknowns.append({
_("{0}, it has been loaded from {1}").format(err, options["source"]): option._subconfig}
)