From 5942a582f5b7d941a2332581cc90d78eacb05506 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 21 Jun 2021 04:09:00 +0200 Subject: [PATCH] [fix] remove bare exceptions --- moulinette/interfaces/__init__.py | 2 +- moulinette/interfaces/api.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/moulinette/interfaces/__init__.py b/moulinette/interfaces/__init__.py index 94e1ad6e..fc3ed911 100644 --- a/moulinette/interfaces/__init__.py +++ b/moulinette/interfaces/__init__.py @@ -479,7 +479,7 @@ class ExtendedArgumentParser(argparse.ArgumentParser): c.execute(namespace, v) try: delattr(namespace, CALLBACKS_PROP) - except: + except Exception: pass def _get_callbacks_queue(self, namespace, create=True): diff --git a/moulinette/interfaces/api.py b/moulinette/interfaces/api.py index 9973fc79..560e98cf 100644 --- a/moulinette/interfaces/api.py +++ b/moulinette/interfaces/api.py @@ -358,7 +358,7 @@ class _ActionsMapPlugin(object): # Retrieve session values try: s_id = request.get_cookie("session.id") or random_ascii() - except: + except Exception: # Super rare case where there are super weird cookie / cache issue # Previous line throws a CookieError that creates a 500 error ... # So let's catch it and just use a fresh ID then... @@ -371,7 +371,7 @@ class _ActionsMapPlugin(object): else: try: s_tokens = request.get_cookie("session.tokens", secret=s_secret) or {} - except: + except Exception: # Same as for session.id a few lines before s_tokens = {} s_new_token = random_ascii() @@ -384,7 +384,7 @@ class _ActionsMapPlugin(object): if len(s_tokens) > 0: try: self.logout(profile) - except: + except Exception: pass raise HTTPResponse(e.strerror, 401) else: