Skip to content

Commit

Permalink
[Fix] Don't try to send errors if raven not found
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jun 9, 2017
1 parent 9774e43 commit ae4d8b5
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/roam/errors.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from raven import Client
"""
Module to handle sending error reports.
"""
import roam
import roam.config
import roam.utils

errorreporting = False
try:
from raven import Client
errorreporting = True
except ImportError:
errorreporting = False
roam.utils.warning("Error reporting disabled due to import error")

client = Client(
dsn='http://681cb73fc39247d0bfa03437a9b53b61:114be99c3a8842188ae7e9381d30374a@sentry.kartoza.com/17',
release=roam.__version__
)


def can_send():
Expand All @@ -19,7 +24,11 @@ def can_send():


def send_exception(exinfo):
if can_send():
if can_send() and errorreporting:
client = Client(
dsn='http://681cb73fc39247d0bfa03437a9b53b61:114be99c3a8842188ae7e9381d30374a@sentry.kartoza.com/17',
release=roam.__version__
)
roam.utils.info("Sending error report.")
client.captureException(exinfo)

0 comments on commit ae4d8b5

Please sign in to comment.