Skip to content

Commit

Permalink
1.6.1dev: Merge r17650 from 1.4-stable
Browse files Browse the repository at this point in the history
Refs #13515


git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/1.6-stable@17725 af82e41b-90c4-0310-8c96-b1721e28e2e2
  • Loading branch information
rjollos committed Sep 25, 2023
1 parent 867743c commit eb2c6a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion trac/notification/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ListOption, Option)
from trac.core import Component, Interface, ExtensionPoint
from trac.util import as_bool, lazy, to_list
from trac.util.text import exception_to_unicode


__all__ = ['IEmailAddressResolver', 'IEmailDecorator', 'IEmailSender',
Expand Down Expand Up @@ -208,6 +209,11 @@ def __init__(self, realm, category, target, time, author=""):
self.time = time
self.author = author

def __repr__(self):
return '<%s realm=%r, category=%r, target=%r, time=%r, author=%r>' % \
(self.__class__.__name__, self.realm, self.category,
self.target, self.time, self.author)


class NotificationSystem(Component):

Expand Down Expand Up @@ -353,7 +359,12 @@ def notify(self, event):
:param event: a `NotificationEvent`
"""
self.distribute_event(event, self.subscriptions(event))
try:
self.distribute_event(event, self.subscriptions(event))
except Exception as e:
self.log.error("Failure distributing event %r%s", event,
exception_to_unicode(e, traceback=True))
raise

def distribute_event(self, event, subscriptions):
"""Distribute a event to all subscriptions.
Expand Down
6 changes: 3 additions & 3 deletions trac/ticket/web_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ def _do_create(self, req, ticket, action):
except Exception as e:
self.log.error("Failure sending notification on creation of "
"ticket #%s: %s",
ticket.id, exception_to_unicode(e, traceback=True))
ticket.id, exception_to_unicode(e))
add_warning(req, tag_("The ticket has been created, but an error "
"occurred while sending notifications: "
"%(message)s", message=to_fragment(e)))
Expand Down Expand Up @@ -1387,8 +1387,8 @@ def _do_save(self, req, ticket, action):
NotificationSystem(self.env).notify(event)
except Exception as e:
self.log.error("Failure sending notification on change to "
"ticket #%s: %s", ticket.id,
exception_to_unicode(e, traceback=True))
"ticket #%s: %s",
ticket.id, exception_to_unicode(e))
# TRANSLATOR: The 'change' has been saved... (link)
change = _('change')
if fragment:
Expand Down

0 comments on commit eb2c6a1

Please sign in to comment.