Modify ↓
Opened 10 years ago
Closed 10 years ago
#11780 closed defect (fixed)
UnicodeError with its traceback should be logged while rendering genshi template
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.5 |
Component: | rendering | Version: | 0.12-stable |
Severity: | normal | Keywords: | genshi |
Cc: | Branch: | ||
Release Notes: |
Add template name to error message if an exception is raised while rendering and location is unknown. |
||
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): 885 885 req.chrome['script_data'] = script_data 886 886 # give some hints when hitting a Genshi unicode error 887 887 if isinstance(e, UnicodeError): 888 self.log.error('Exception caught while rendering %s%s', 889 filename, 890 exception_to_unicode(e, traceback=True)) 888 891 pos = self._stream_location(stream) 889 892 if pos: 890 893 location = "'%s', line %s, char %s" % pos
Attachments (0)
Change History (5)
comment:1 by , 10 years ago
Milestone: | 0.12.7 → 1.0.3 |
---|---|
Owner: | set to |
Status: | new → assigned |
comment:2 by , 10 years ago
Milestone: | 1.0.3 → 1.0.4 |
---|
comment:3 by , 10 years ago
Milestone: | 1.0.4 → 1.0.5 |
---|
comment:4 by , 10 years ago
comment:5 by , 10 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Committed the patch in comment:4 in [13779-13780].
Note:
See TracTickets
for help on using tickets.
That is less-useful….
Instead, it would be better to add the template filename to error message when (unknown template location).
trac/web/chrome.py