Add marshmallow error handling to spec validation
@@ -19,7 +19,7 @@ from polyaxon_schemas.polyaxonfile.specification import (
def validate_experiment_spec_config(config, raise_for_rest=False):
try:
spec = ExperimentSpecification.read(config)
- except (PolyaxonfileError, PolyaxonConfigurationError) as e:
+ except (MarshmallowValidationError, PolyaxonfileError, PolyaxonConfigurationError) as e:
message_error = 'Received non valid specification config. %s' % e
if raise_for_rest:
raise ValidationError(message_error)
@@ -32,7 +32,7 @@ def validate_experiment_spec_config(config, raise_for_rest=False):
def validate_group_spec_content(content, raise_for_rest=False):
try:
spec = GroupSpecification.read(content)
- except (PolyaxonfileError, PolyaxonConfigurationError) as e:
+ except (MarshmallowValidationError, PolyaxonfileError, PolyaxonConfigurationError) as e:
message_error = 'Received non valid specification content. %s' % e
if raise_for_rest:
raise ValidationError(message_error)
@@ -55,7 +55,7 @@ def validate_group_hptuning_config(config, raise_for_rest=False):
def validate_notebook_spec_config(config, raise_for_rest=False):
try:
spec = NotebookSpecification.read(config)
- except (PolyaxonfileError, PolyaxonConfigurationError) as e:
+ except (MarshmallowValidationError, PolyaxonfileError, PolyaxonConfigurationError) as e:
message_error = 'Received non valid notebook specification config. %s' % e
if raise_for_rest:
raise ValidationError(message_error)
@@ -68,7 +68,7 @@ def validate_notebook_spec_config(config, raise_for_rest=False):
def validate_tensorboard_spec_config(config, raise_for_rest=False):
try:
spec = TensorboardSpecification.read(config)
- except (PolyaxonfileError, PolyaxonConfigurationError) as e:
+ except (MarshmallowValidationError, PolyaxonfileError, PolyaxonConfigurationError) as e:
message_error = 'Received non valid tensorboard specification config. %s' % e
if raise_for_rest:
raise ValidationError(message_error)
@@ -81,7 +81,7 @@ def validate_tensorboard_spec_config(config, raise_for_rest=False):
def validate_build_spec_config(config, raise_for_rest=False):
try:
spec = BuildSpecification.read(config)
- except (PolyaxonfileError, PolyaxonConfigurationError) as e:
+ except (MarshmallowValidationError, PolyaxonfileError, PolyaxonConfigurationError) as e:
message_error = 'Received non valid build specification config. %s' % e
if raise_for_rest:
raise ValidationError(message_error)
@@ -94,7 +94,7 @@ def validate_build_spec_config(config, raise_for_rest=False):
def validate_job_spec_config(config, raise_for_rest=False):
try:
spec = JobSpecification.read(config)
- except (PolyaxonfileError, PolyaxonConfigurationError) as e:
+ except (MarshmallowValidationError, PolyaxonfileError, PolyaxonConfigurationError) as e:
message_error = 'Received non valid job specification config. %s' % e
if raise_for_rest:
raise ValidationError(message_error)
