# HG changeset patch # User Marcin Kuzminski # Date 2018-09-06 17:27:53 # Node ID a41e7b95e6cb3852a44aa9d2f33c3ad29800262c # Parent 9b4df49058b84eb7f43d79a329d7ab23d8180ec8 exception-tracker: store event sending exception for easier event fail debugging. diff --git a/rhodecode/integrations/__init__.py b/rhodecode/integrations/__init__.py --- a/rhodecode/integrations/__init__.py +++ b/rhodecode/integrations/__init__.py @@ -17,11 +17,13 @@ # This program is dual-licensed. If you wish to learn more about the # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ - +import sys import logging from rhodecode.integrations.registry import IntegrationTypeRegistry from rhodecode.integrations.types import webhook, slack, hipchat, email, base +from rhodecode.lib.exc_tracking import store_exception + log = logging.getLogger(__name__) @@ -61,6 +63,8 @@ def integrations_event_handler(event): try: integration_model.send_event(integration, event) except Exception: + exc_info = sys.exc_info() + store_exception(id(exc_info), exc_info) log.exception( 'failure occurred when sending event %s to integration %s' % ( event, integration)) diff --git a/rhodecode/lib/exc_tracking.py b/rhodecode/lib/exc_tracking.py --- a/rhodecode/lib/exc_tracking.py +++ b/rhodecode/lib/exc_tracking.py @@ -87,6 +87,13 @@ def _store_exception(exc_id, exc_info, p def store_exception(exc_id, exc_info, prefix=global_prefix): + """ + Example usage:: + + exc_info = sys.exc_info() + store_exception(id(exc_info), exc_info) + """ + try: _store_exception(exc_id=exc_id, exc_info=exc_info, prefix=prefix) except Exception: