Edgewall Software

Changeset 17650


Ignore:
Timestamp:
Jan 13, 2023, 11:28:41 AM (9 months ago)
Author:
Jun Omae
Message:

1.4.4dev: automatically logs the exception and its traceback when NotificationSystem.notify raises an exception (refs #13515)

Location:
branches/1.4-stable/trac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.4-stable/trac/notification/api.py

    r17592 r17650  
    2424from trac.core import Component, Interface, ExtensionPoint
    2525from trac.util import as_bool, lazy, to_list
     26from trac.util.text import exception_to_unicode
    2627
    2728
     
    210211        self.author = author
    211212
     213    def __repr__(self):
     214        return '<%s realm=%r, category=%r, target=%r, time=%r, author=%r>' % \
     215               (self.__class__.__name__, self.realm, self.category,
     216                self.target, self.time, self.author)
     217
    212218
    213219class NotificationSystem(Component):
     
    371377        :param event: a `NotificationEvent`
    372378        """
    373         self.distribute_event(event, self.subscriptions(event))
     379        try:
     380            self.distribute_event(event, self.subscriptions(event))
     381        except Exception as e:
     382            self.log.error("Failure distributing event %r%s", event,
     383                           exception_to_unicode(e, traceback=True))
     384            raise
    374385
    375386    def distribute_event(self, event, subscriptions):
  • branches/1.4-stable/trac/ticket/web_ui.py

    r17602 r17650  
    13731373            self.log.error("Failure sending notification on creation of "
    13741374                           "ticket #%s: %s",
    1375                            ticket.id, exception_to_unicode(e, traceback=True))
     1375                           ticket.id, exception_to_unicode(e))
    13761376            add_warning(req, tag_("The ticket has been created, but an error "
    13771377                                  "occurred while sending notifications: "
     
    14131413            except Exception as e:
    14141414                self.log.error("Failure sending notification on change to "
    1415                                "ticket #%s: %s", ticket.id,
    1416                                exception_to_unicode(e, traceback=True))
     1415                               "ticket #%s: %s",
     1416                               ticket.id, exception_to_unicode(e))
    14171417                # TRANSLATOR: The 'change' has been saved... (link)
    14181418                change = _('change')
Note: See TracChangeset for help on using the changeset viewer.