mirror of
https://github.com/docker/compose.git
synced 2025-07-26 15:14:04 +02:00
Improve error message for type constraints
It was missing a space between the different types, when there were 3 possible type values. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
24d4a1045a
commit
5fdb75b541
@ -136,7 +136,7 @@ def process_errors(errors, service_name=None):
|
|||||||
if len(validator) >= 2:
|
if len(validator) >= 2:
|
||||||
first_type = anglicize_validator(validator[0])
|
first_type = anglicize_validator(validator[0])
|
||||||
last_type = anglicize_validator(validator[-1])
|
last_type = anglicize_validator(validator[-1])
|
||||||
types_from_validator = "{}{}".format(first_type, ", ".join(validator[1:-1]))
|
types_from_validator = "{}".format(", ".join([first_type] + validator[1:-1]))
|
||||||
|
|
||||||
msg = "{} or {}".format(
|
msg = "{} or {}".format(
|
||||||
types_from_validator,
|
types_from_validator,
|
||||||
@ -156,7 +156,6 @@ def process_errors(errors, service_name=None):
|
|||||||
Inspecting the context value of a ValidationError gives us information about
|
Inspecting the context value of a ValidationError gives us information about
|
||||||
which sub schema failed and which kind of error it is.
|
which sub schema failed and which kind of error it is.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
required = [context for context in error.context if context.validator == 'required']
|
required = [context for context in error.context if context.validator == 'required']
|
||||||
if required:
|
if required:
|
||||||
return required[0].message
|
return required[0].message
|
||||||
|
Loading…
x
Reference in New Issue
Block a user