#1021 new defect

report all exceptions

Reported by: zooko Owned by: warner
Priority: major Milestone: eventually
Component: code Version: 1.6.1
Keywords: logging foolscap error Cc:
Launchpad Bug:


I'm not sure, but it seems like sometimes an exception can be raised from our code or from some libraries that we use and that exception silently vanishes instead of being logged. There is an allegation of this happening in #710 and in #807. Brian: is this possible? How would an exception get caught and not get logged?

Change History (3)

comment:1 Changed at 2010-04-13T04:35:12Z by zooko

Well I guess the next step, aside from asking Brian to give his opinion on the topic, is to take #710 and #807 and try to turn them into reproducible test cases -- insert an exception-raising statement into the appropriate part of the code (maybe using voidspace mock lib which I like http://www.voidspace.org.uk/python/mock/ ) and then check whether that exception got logged properly.

comment:2 Changed at 2010-04-13T17:59:36Z by davidsarah

  • Keywords error added

comment:3 Changed at 2010-05-04T03:50:19Z by davidsarah

The following code (based on this article) prints all exceptions raised after it is run:

import sys

def trace_exceptions(frame, event, arg):
    if event != 'exception':
    co = frame.f_code
    func_name = co.co_name
    line_no = frame.f_lineno
    filename = co.co_filename
    exc_type, exc_value, exc_traceback = arg
    print 'Tracing exception: %s "%s" on line %s of %s' % \
        (exc_type.__name__, exc_value, line_no, func_name)

def trace_calls(frame, event, arg):
    if event != 'call':
    return trace_exceptions


The results are interesting but quite voluminous, and would need to be filtered.

Note: See TracTickets for help on using tickets.