Skip to content

Replace general Exception raising with more detailed type #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
4 changes: 2 additions & 2 deletions flask_mongoengine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__(self, app=None, config=None):

def init_app(self, app, config=None):
if not app or not isinstance(app, Flask):
raise Exception("Invalid Flask application instance")
raise TypeError("Invalid Flask application instance")

self.app = app

Expand All @@ -119,7 +119,7 @@ def init_app(self, app, config=None):
if self in app.extensions["mongoengine"]:
# Raise an exception if extension already initialized as
# potentially new configuration would not be loaded.
raise Exception("Extension already initialized")
raise ValueError("Extension already initialized")

if not config:
# If not passed a config then we read the connection settings
Expand Down