Skip to content

Commit

Permalink
Don't catch BaseExceptions (#161)
Browse files Browse the repository at this point in the history
Exiting exceptions, such as `KeyboardInterrupt`, inherit from `BaseException` rather than `Exception`. The idiomatic way to catch any unexpected exception is to only catch `Exception`, so that `BaseExceptions` still bubble up.
  • Loading branch information
adamchainz authored and pcraciunoiu committed Oct 3, 2018
1 parent 2e712e6 commit 1a269d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions django_ses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def open(self):
proxy_user=self._proxy_user,
proxy_pass=self._proxy_pass,
)
except:
except Exception:
if not self.fail_silently:
raise

Expand All @@ -101,7 +101,7 @@ def close(self):
try:
self.connection.close()
self.connection = None
except:
except Exception:
if not self.fail_silently:
raise

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def find_package_data(where=".", package="", exclude=standard_exclude,
LONG_DESCRIPTION = None
try:
LONG_DESCRIPTION = open('README.rst').read()
except:
except Exception:
pass

CLASSIFIERS = [
Expand Down

0 comments on commit 1a269d5

Please sign in to comment.