Give more helpful feedback when raven cannot be imported

master
Nick Groenen 2012-10-07 20:25:56 +02:00
parent e6693d8c7d
commit 73359a52ab
1 changed files with 5 additions and 1 deletions

View File

@ -94,7 +94,11 @@ def main(bot_class):
logger.setLevel(BOT_LOG_LEVEL)
if BOT_LOG_SENTRY:
from raven.handlers.logging import SentryHandler
try:
from raven.handlers.logging import SentryHandler
except ImportError, e:
logging.exception("You have BOT_LOG_SENTRY enabled, but I couldn't import modules needed for Sentry integration.\nDid you install raven? (See http://raven.readthedocs.org/en/latest/install/index.html for installation instructions)\n\n")
exit(-1)
from config import SENTRY_DSN, SENTRY_LOGLEVEL
sentryhandler = SentryHandler(SENTRY_DSN, level=SENTRY_LOGLEVEL)
logger.addHandler(sentryhandler)