Edgewall Software

Opened 10 years ago

Last modified 9 years ago

#11780 closed defect

UnicodeError with its traceback should be logged while rendering genshi template — at Initial Version

Reported by: Jun Omae Owned by:
Priority: normal Milestone: 1.0.5
Component: rendering Version: 0.12-stable
Severity: normal Keywords: genshi
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

If an UnicodeError raises while rendering genshi template, traceback of the error will not be logged. The behavior makes increasingly difficult to solve, especially if rendering unknown template location.

I think we should log the error with its traceback in this case.

  • trac/web/chrome.py

    diff --git a/trac/web/chrome.py b/trac/web/chrome.py
    index 344448b..fd14cbd 100644
    a b class Chrome(Component):  
    885885            req.chrome['script_data'] = script_data
    886886            # give some hints when hitting a Genshi unicode error
    887887            if isinstance(e, UnicodeError):
     888                self.log.error('Exception caught while rendering %s%s',
     889                               filename,
     890                               exception_to_unicode(e, traceback=True))
    888891                pos = self._stream_location(stream)
    889892                if pos:
    890893                    location = "'%s', line %s, char %s" % pos

Change History (0)

Note: See TracTickets for help on using tickets.