Improve error messages for invalid versions
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
aeef61fcd8
commit
ef8db3650a
5 changed files with 71 additions and 42 deletions
|
|
@ -15,6 +15,7 @@ from jsonschema import RefResolver
|
|||
from jsonschema import ValidationError
|
||||
|
||||
from .errors import ConfigurationError
|
||||
from .errors import VERSION_EXPLANATION
|
||||
from .sort_services import get_service_name_from_network_mode
|
||||
|
||||
|
||||
|
|
@ -229,11 +230,14 @@ def handle_error_for_schema_with_id(error, path):
|
|||
"A service can either be built to image or use an existing "
|
||||
"image, not both.".format(path_string(path)))
|
||||
|
||||
if schema_id == '#/definitions/service':
|
||||
if error.validator == 'additionalProperties':
|
||||
if error.validator == 'additionalProperties':
|
||||
if schema_id == '#/definitions/service':
|
||||
invalid_config_key = parse_key_from_error_msg(error)
|
||||
return get_unsupported_config_msg(path, invalid_config_key)
|
||||
|
||||
if not error.path:
|
||||
return '{}\n{}'.format(error.message, VERSION_EXPLANATION)
|
||||
|
||||
|
||||
def handle_generic_service_error(error, path):
|
||||
msg_format = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue