Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

#12820 closed enhancement (fixed)

Log resource name for macro and processor errors

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.14
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Macro or processor failure logs the resource.

API Changes:
Internal Changes:

Description

Currently the resource realm and id are not logged. Example:

2017-05-24 15:20:24,905 Trac[formatter] ERROR: Macro SiblingPage(None) failed:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/trac/wiki/formatter.py", line 765, in _macro_formatter
    return macro.ensure_inline(macro.process(args))
  File "/usr/lib/python2.7/site-packages/trac/wiki/formatter.py", line 356, in process
    text = self.processor(text)
  File "/usr/lib/python2.7/site-packages/trac/wiki/formatter.py", line 340, in _macro_processor
    text, self.args)
  File "build/bdist.linux-x86_64/egg/neighborpage/nav.py", line 76, in expand_macro
    prefix = '/' in page and page[:page.rindex('/') + 1] or ''
TypeError: argument of type 'NoneType' is not iterable

Attachments (0)

Change History (2)

comment:1 by Ryan J Ollos, 7 years ago

Proposed change:

  • trac/wiki/formatter.py

    diff --git a/trac/wiki/formatter.py b/trac/wiki/formatter.py
    index fba9d7bf7..46f5508ad 100644
    a b class Formatter(object):  
    794794        except MacroError, e:
    795795            return system_message(e)
    796796        except Exception, e:
    797             self.env.log.error('Macro %s(%s) failed:%s', name, args,
     797            self.env.log.error("Macro %s(%s) failed in %s:%s:%s", name,
     798                               args, self.resource.realm, self.resource.id,
    798799                               exception_to_unicode(e, traceback=True))
    799800            return system_message(_("Error: Macro %(name)s(%(args)s) failed",
    800801                                    name=name, args=args), to_unicode(e))
    class Formatter(object):  
    11871188        try:
    11881189            return processor.process(text)
    11891190        except Exception, e:
    1190             self.env.log.error('Processor %s failed:%s', processor.name,
     1191            self.env.log.error("Processor %s failed in %s:%s:%s",
     1192                               processor.name, self.resource.realm,
     1193                               self.resource.id,
    11911194                               exception_to_unicode(e, traceback=True))
    11921195            return system_message(_("Error: Processor %(name)s failed",
    11931196                                    name=processor.name), to_unicode(e))

comment:2 by Ryan J Ollos, 7 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in r15944, merged to 1.2-stable in r15945, merged to trunk r15946.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.