Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #87 from sul-cidr/reraise#82
Browse files Browse the repository at this point in the history
Closes #82. Re-raise exceptions properly in the pipeline command
  • Loading branch information
csbailey5t committed Dec 12, 2016
2 parents 0c43400 + cc7f159 commit 0c16333
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion histonets/cli.py
Expand Up @@ -71,7 +71,10 @@ def pipeline(image, actions):
raise click.BadParameter(
"Action '{}' not found".format(action['action']))
options['output'] = RAW
output = command.callback(*arguments, **options)
try:
output = command.callback(*arguments, **options)
except TypeError as e:
raise click.BadParameter(e)
return output


Expand Down
10 changes: 10 additions & 0 deletions tests/test_cli.py
Expand Up @@ -237,6 +237,16 @@ def test_command_pipeline_invalid(self):
assert 'Error' in result.output
assert len(result.output.strip()) > 0

def test_command_pipeline_reraise_error(self):
actions = json.dumps([
{"action": "posterize", "options":
{"value": 4, "method": "linear"}}
])
result = self.runner.invoke(cli.pipeline, [actions, self.image_file])
assert 'Error' in result.output
assert not isinstance(result.exception, TypeError)
assert len(result.output.strip()) > 0

def test_command_posterize_linear(self):
result = self.runner.invoke(
cli.posterize,
Expand Down

0 comments on commit 0c16333

Please sign in to comment.