Skip to content

Commit

Permalink
validate: show YAML parsing errors
Browse files Browse the repository at this point in the history
Closes #676
  • Loading branch information
mdonadoni committed Oct 23, 2023
1 parent 4dde3bb commit 226eb7f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions reana_client/cli/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from reana_commons.config import INTERACTIVE_SESSION_TYPES, REANA_COMPUTE_BACKENDS
from reana_commons.errors import REANAValidationError
from reana_commons.validation.operational_options import validate_operational_options
import yaml

from reana_client.cli.files import get_files, upload_files
from reana_client.cli.utils import (
Expand Down Expand Up @@ -1008,6 +1009,15 @@ def workflow_validate(
msg_type="error",
)
sys.exit(1)
except yaml.parser.ParserError as e:
logging.debug(traceback.format_exc())
display_message(
"{0} is not a valid YAML file:\n{1}".format(
click.format_filename(file, shorten=True), e
),
msg_type="error",
)
sys.exit(1)
except Exception as e:
logging.debug(traceback.format_exc())
logging.debug(str(e))
Expand Down

0 comments on commit 226eb7f

Please sign in to comment.