Skip to content

Commit

Permalink
Gracefully handle plugin errors in plugins.first()
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Feb 24, 2012
1 parent a3e9c36 commit c623df3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sentry/plugins/base.py
Expand Up @@ -8,6 +8,8 @@

__all__ = ('Plugin', 'plugins', 'register')

import logging

from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse

Expand Down Expand Up @@ -55,7 +57,16 @@ def get(self, slug):

def first(self, func_name, *args, **kwargs):
for plugin in self.all():
result = getattr(plugin, func_name)(*args, **kwargs)
try:
result = getattr(plugin, func_name)(*args, **kwargs)
except Exception, e:
logger = logging.getLogger('sentry.plugins')
logger.error('Error processing %s() on %r: %s', func_name, plugin.__class__, e, extra={
'args': args,
'kwargs': kwargs,
}, exc_info=True)
continue

if result is not None:
return result

Expand Down

0 comments on commit c623df3

Please sign in to comment.