Skip to content

Commit

Permalink
Raise a ValueError when len(hash) != 32
Browse files Browse the repository at this point in the history
  • Loading branch information
sbellem committed Jun 22, 2017
1 parent 4ac636d commit ad03c42
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cryptoconditions/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def hash(self, value):
"""
# TODO Use more precise Exception class
if len(value) != 32:
raise Exception(
raise ValueError(
'Hash is of invalid length {}, should be 32'.format(len(value))
)
self._hash = value
Expand Down
2 changes: 1 addition & 1 deletion tests/test_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_condition_hash():
condition = Condition()

# raises an exception if hash is not 32 bytes long
with raises(Exception):
with raises(ValueError):
condition.hash = 'a'

# raises a ValueError if the hash is not set
Expand Down

0 comments on commit ad03c42

Please sign in to comment.