Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit d4cfa79

Browse files
author
Olivier Gambier
committed
Better bugsnag exception handling
Docker-DCO-1.1-Signed-off-by: Olivier Gambier <[email protected]> (github: dmp42)
1 parent 505f8dd commit d4cfa79

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

docker_registry/extras/bugsnag.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
def boot(application, api_key, flavor, version):
77
# Configure bugsnag
88
if api_key:
9-
import bugsnag
10-
import bugsnag.flask
9+
try:
10+
import bugsnag
11+
import bugsnag.flask
1112

12-
root_path = os.path.abspath(
13-
os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
14-
bugsnag.configure(api_key=api_key,
15-
project_root=root_path,
16-
release_stage=flavor,
17-
notify_release_stages=[flavor],
18-
app_version=version
19-
)
20-
bugsnag.flask.handle_exceptions(application)
13+
root_path = os.path.abspath(
14+
os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
15+
bugsnag.configure(api_key=api_key,
16+
project_root=root_path,
17+
release_stage=flavor,
18+
notify_release_stages=[flavor],
19+
app_version=version
20+
)
21+
bugsnag.flask.handle_exceptions(application)
22+
except Exception as e:
23+
raise Exception('Failed to init bugsnag agent %s' % e)

0 commit comments

Comments
 (0)