Skip to content

Instantly share code, notes, and snippets.

@krets
Created April 22, 2014 21:28
Show Gist options
  • Save krets/11194998 to your computer and use it in GitHub Desktop.
Save krets/11194998 to your computer and use it in GitHub Desktop.
import sys
import getpass
sentry_url = 'http://<hash>:<hash>@sentry-server.local/1'
try:
import raven
RAVEN_CLIENT = raven.Client(sentry_url)
RAVEN_CLIENT.tags_context({'user':getpass.getuser()})
except:
RAVEN_CLIENT = None
def exceptionHandler(excType, excValue, traceback):
if RAVEN_CLIENT!=None:
RAVEN_CLIENT.captureException(exc_info=(excType, excValue, traceback))
sys.excepthook = exceptionHandler
@krets
Copy link
Author

krets commented Apr 22, 2014

I usually have much more going on with the exceptionHandler, but this is a bare-bones example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment