Skip to content

Commit

Permalink
Better error if config is malformed
Browse files Browse the repository at this point in the history
  • Loading branch information
djf604 committed Mar 23, 2018
1 parent 981dbb5 commit ed55c1a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion operon/_cli/__init__.py
Expand Up @@ -12,7 +12,7 @@ def get_operon_subcommands(classes=False):
]
]
if not classes:
return operon_subcommands
return [o.replace('_', '-') for o in operon_subcommands]

return {
operon_subcommand: fetch_subcommand_class(operon_subcommand)
Expand Down
2 changes: 1 addition & 1 deletion operon/_cli/_completer.py
Expand Up @@ -46,7 +46,7 @@ def completer():
stub=stub_token
)
elif num_completed_tokens == 2:
if phrase[-2] in {'run', 'configure', 'show', 'uninstall'}:
if phrase[-2] in {'run', 'batch-run', 'configure', 'show', 'uninstall'}:
completion_options = get_completion_options(
options=get_pipeline_options(),
stub=stub_token
Expand Down
4 changes: 2 additions & 2 deletions operon/_cli/subcommands/configure.py
Expand Up @@ -274,8 +274,8 @@ def run(self, subcommand_args):
except (KeyboardInterrupt, EOFError):
sys.stderr.write('\nUser aborted configuration.\n')
sys.exit(EXIT_CMD_SUCCESS)
except AttributeError:
raise MalformedPipelineConfigError('Something about the configuration is malformed')
except AttributeError as e:
raise MalformedPipelineConfigError('Something about the configuration is malformed: {}'.format(e))

# Write config out to file
try:
Expand Down
2 changes: 1 addition & 1 deletion operon/_util/__init__.py
Expand Up @@ -37,7 +37,7 @@ def execute_from_command_line(argv=None):
parser.print_help()
sys.exit(0)
try:
operon_subcommand_classes[subcommand].run(argv[2:])
operon_subcommand_classes[subcommand.replace('-', '_')].run(argv[2:])
except Exception as e:
sys.stderr.write('Operon encountered an error when trying to execute {}:\n'.format(subcommand))
sys.stderr.write(str(e) + '\n')
Expand Down

0 comments on commit ed55c1a

Please sign in to comment.