summaryrefslogtreecommitdiff
path: root/macaroonbakery/bakery/_oven.py
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2018-10-15 10:58:26 +0100
committerColin Watson <cjwatson@debian.org>2018-10-15 10:58:56 +0100
commitf00e0b7d3ea974ffaa8bc284ad2b7df6fcb77eb2 (patch)
tree5acfe37d50981ef409c3a0753b8d048eaed53558 /macaroonbakery/bakery/_oven.py
parent83e714c5f5f17a4db661ba942f8da617dccac9bb (diff)
parent619cb9d927e2d6955d0b6a97d4d4c5ea9548150a (diff)
Update upstream source from tag 'upstream/1.2.1'
Update to upstream version '1.2.1' with Debian dir ccd0e7fdc6e29a6c6f8c47c3e463ae6e6a3343c3
Diffstat (limited to 'macaroonbakery/bakery/_oven.py')
-rw-r--r--macaroonbakery/bakery/_oven.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/macaroonbakery/bakery/_oven.py b/macaroonbakery/bakery/_oven.py
index 414a164..d0a2a23 100644
--- a/macaroonbakery/bakery/_oven.py
+++ b/macaroonbakery/bakery/_oven.py
@@ -28,10 +28,6 @@ from macaroonbakery._utils import (
)
from ._internal import id_pb2
from pymacaroons import MACAROON_V2, Verifier
-from pymacaroons.exceptions import (
- MacaroonInvalidSignatureException,
- MacaroonUnmetCaveatException,
-)
class Oven:
@@ -183,10 +179,20 @@ class Oven:
v.satisfy_general(validator)
try:
v.verify(macaroons[0], root_key, macaroons[1:])
- except (MacaroonUnmetCaveatException,
- MacaroonInvalidSignatureException) as exc:
- raise VerificationError(
- 'verification failed: {}'.format(exc.args[0]))
+ except Exception as exc:
+ # Unfortunately pymacaroons doesn't control
+ # the set of exceptions that can be raised here.
+ # Possible candidates are:
+ # pymacaroons.exceptions.MacaroonUnmetCaveatException
+ # pymacaroons.exceptions.MacaroonInvalidSignatureException
+ # ValueError
+ # nacl.exceptions.CryptoError
+ #
+ # There may be others too, so just catch everything.
+ raise six.raise_from(
+ VerificationError('verification failed: {}'.format(str(exc))),
+ exc,
+ )
if (self.ops_store is not None
and len(ops) == 1