From ee66145fc79f1ef2840267718f54fd89463c67f5 Mon Sep 17 00:00:00 2001 From: David Reid Date: Wed, 13 Nov 2013 13:52:55 -0800 Subject: Add a message. --- cryptography/hazmat/primitives/hmac.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cryptography/hazmat/primitives/hmac.py b/cryptography/hazmat/primitives/hmac.py index cd0fd813..1bbe39c7 100644 --- a/cryptography/hazmat/primitives/hmac.py +++ b/cryptography/hazmat/primitives/hmac.py @@ -39,14 +39,14 @@ class HMAC(object): def update(self, msg): if self._ctx is None: - raise AlreadyFinalized() + raise AlreadyFinalized("Context was already finalized") if isinstance(msg, six.text_type): raise TypeError("Unicode-objects must be encoded before hashing") self._ctx.update(msg) def copy(self): if self._ctx is None: - raise AlreadyFinalized() + raise AlreadyFinalized("Context was already finalized") return HMAC( self._key, self.algorithm, @@ -56,8 +56,7 @@ class HMAC(object): def finalize(self): if self._ctx is None: - raise AlreadyFinalized() - + raise AlreadyFinalized("Context was already finalized") digest = self._ctx.finalize() self._ctx = None return digest -- cgit v1.2.3