Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Only catch the exceptions we're mapping to responses
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlmorton committed Sep 11, 2014
1 parent 87f1311 commit 4a02b52
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ptero_common/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, realm=None, scopes=[], claims=[], audiences=[]):
self.audiences = audiences
self.exception_map = construct_exception_map(realm, scopes,
claims, audiences)
self.mapped_exceptions = tuple(self.exception_map.keys())

def __call__(self, target):
self.target = target
Expand All @@ -22,7 +23,7 @@ def __call__(self, target):
def _execute_target(self, *args, **kwargs):
try:
id_token = self._extract_id_token()
except Exception as e:
except self.mapped_exceptions as e:
return self.exception_map[e.__class__]
return self.target(*args, id_token=id_token, **kwargs)

Expand Down

0 comments on commit 4a02b52

Please sign in to comment.