Enhance error handling in scodoc7 decorator.

This commit is contained in:
Emmanuel Viennet 2023-09-05 21:49:10 +02:00
parent 6b43456a71
commit 5b76654b7b
2 changed files with 11 additions and 1 deletions

View File

@ -186,7 +186,10 @@ def scodoc7func(func):
arg_names = argspec.args arg_names = argspec.args
for arg_name in arg_names: # pour chaque arg de la fonction vue for arg_name in arg_names: # pour chaque arg de la fonction vue
# peut produire une KeyError s'il manque un argument attendu: # peut produire une KeyError s'il manque un argument attendu:
try:
v = req_args[arg_name] v = req_args[arg_name]
except KeyError as exc:
raise ScoValueError(f"argument {arg_name} manquant") from exc
# try to convert all arguments to INTEGERS # try to convert all arguments to INTEGERS
# necessary for db ids and boolean values # necessary for db ids and boolean values
try: try:

View File

@ -15,4 +15,11 @@
{% endif %} {% endif %}
</p> </p>
<p style="margin-top: 32px;" class="help">
Si le problème persiste, merci de contacter le support ScoDoc via
<a class="stdlink" noreferer href="{{scu.SCO_DISCORD_ASSISTANCE|safe}}">
{{scu.SCO_DISCORD_ASSISTANCE}}
</a>
</p>
{% endblock %} {% endblock %}