Skip to content

Commit

Permalink
Small appier refactor for exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 8, 2019
1 parent cd02a21 commit 21921b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/appier/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,9 +1423,7 @@ def application_l(self, environ, start_response):
else: raise exceptions.OperationalError(
message = "No message size defined for generator"
)
except (KeyboardInterrupt, SystemExit):
raise
except BaseException as exception:
except Exception as exception:
# resets the values associated with the generator based strategy so
# that the error/exception is handled in the proper (non generator)
# way and no interference exists for such situation, otherwise some
Expand Down Expand Up @@ -1887,7 +1885,7 @@ def async_method(*args, **kwargs):
# while handling the request the error should be properly serialized
# suing the proper error handler method for the exception
try: result = method(*args, **kwargs)
except BaseException as exception:
except Exception as exception:
result = self.handle_error(exception)
self.trigger("exception", exception)

Expand Down
2 changes: 1 addition & 1 deletion src/appier/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def get_messages_l(self, level):
# in case the level is not found in the list of levels
# it's not considered valid and so an empty list is returned
try: index = LEVELS.index(level)
except BaseException: return collections.deque()
except: return collections.deque()

# retrieves the complete set of levels that are considered
# equal or more severe than the requested one
Expand Down
2 changes: 1 addition & 1 deletion src/appier/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ def get_tokens_m(self, request = None, set = None):
try:
if hasattr(request, "tokens_p"): tokens_m = request.tokens_p()
else: tokens_m = request.session.get("tokens", {})
except BaseException:
except:
return dict()

# verifies if the resulting value is either a map or a sequence,
Expand Down

0 comments on commit 21921b4

Please sign in to comment.