zope.exceptions API documentation

zope.exceptions.interfaces

ITracebackSupplement interface definition.

When zope.exceptionformatter generates a traceback, it looks for local variables named __traceback_info__ or __traceback_supplement__. It includes the information provided by those local variables in the traceback.

__traceback_info__ is for arbitrary information. repr(__traceback_info__) gets dumped to the traceback.

__traceback_supplement__ is more structured. It should be a tuple. The first item of the tuple is a callable that produces an object that implements ITracebackSupplement, and the rest of the tuple contains arguments to pass to the factory. The traceback formatter makes an effort to clearly present the information provided by the ITracebackSupplement.

ITracebackSupplement

zope.exceptions.exceptionformatter

An exception formatter that shows traceback supplements and traceback info, optionally in HTML.

format_exception()

zope.exceptions.exceptionformatter.format_exception(t, v, tb, limit=None, as_html=False, with_filenames=False)[source]

Format a stack trace and the exception information.

Similar to ‘traceback.format_exception’, but adds supplemental information to the traceback and accepts two options, ‘as_html’ and ‘with_filenames’.

The result is a list of strings.

extract_stack()

zope.exceptions.exceptionformatter.extract_stack(f=None, limit=None, as_html=False, with_filenames=True)[source]

Format a stack trace and the exception information.

Similar to ‘traceback.extract_stack’, but adds supplemental information to the traceback and accepts two options, ‘as_html’ and ‘with_filenames’.