Skip to content

Support chaining in the exception formatter #11

Open
@mgedmin

Description

@mgedmin

In zodbbrowser's test suite I monkey-patch traceback.print_exception and traceback.format_exception so I can see the additional bits that zope.exception formatter provides (__traceback_info__ etc.) when an uncaught exception happens in a background thread.

On Python 3 this causes a problem:

Unhandled exception in thread started by <bound method Thread._bootstrap of <Thread(server, started daemon 140073167124224)>>
Traceback (most recent call last):
  ...
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 879, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.4/threading.py", line 921, in _bootstrap_inner
    (self.name, _format_exc()), file=self._stderr)
  File "/usr/lib/python3.4/traceback.py", line 256, in format_exc
    return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))
TypeError: format_exception() got an unexpected keyword argument 'chain'

So: I would like to add support for exception chaining.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions