mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
form: parse pydantic error in logging
This commit is contained in:
parent
51d302bf18
commit
2f4c88ec55
1 changed files with 6 additions and 3 deletions
|
@ -1537,7 +1537,11 @@ def prompt_or_validate_form(
|
||||||
except (ValidationError, YunohostValidationError) as e:
|
except (ValidationError, YunohostValidationError) as e:
|
||||||
# If in interactive cli, re-ask the current question
|
# If in interactive cli, re-ask the current question
|
||||||
if i < MAX_RETRIES and interactive:
|
if i < MAX_RETRIES and interactive:
|
||||||
logger.error(str(e))
|
logger.error(
|
||||||
|
"\n".join([err["msg"] for err in e.errors()])
|
||||||
|
if isinstance(e, ValidationError)
|
||||||
|
else str(e)
|
||||||
|
)
|
||||||
value = None
|
value = None
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -1627,8 +1631,7 @@ def parse_raw_options(
|
||||||
model = OptionsModel(**raw_options)
|
model = OptionsModel(**raw_options)
|
||||||
except ValidationError as e:
|
except ValidationError as e:
|
||||||
error = "\n".join([err["msg"] for err in e.errors()])
|
error = "\n".join([err["msg"] for err in e.errors()])
|
||||||
# FIXME use YunohostError instead since it is not really a user mistake?
|
raise YunohostError(error, raw_msg=True)
|
||||||
raise YunohostValidationError(error, raw_msg=True)
|
|
||||||
|
|
||||||
model.translate_options()
|
model.translate_options()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue