jgdv.debugging.traceback_factory

Classes

TracebackFactory

A Helper to simplify access to tracebacks.

Module Contents

class jgdv.debugging.traceback_factory.TracebackFactory(*, chop_self=True)[source]

A Helper to simplify access to tracebacks. By Default, removes the frames of this tracebuilder from the trace ie : TraceBuilder._get_frames() -> TraceBuilder.__init__() -> call -> call -> root will be: call -> call -> root

use item acccess to limit the frames, eg: tb[2:], will remove the two most recent frames from the traceback

Use as: tb = TraceBuilder() raise Exception().with_traceback(tb[:])

Parameters:

chop_self (bool)

_get_frames() <Unknown>[source]

from https://stackoverflow.com/questions/27138440 Builds the frame stack from most recent to least,

Return type:

None

to_tb(frames=None) <Unknown>[source]
Parameters:

frames (jgdv.Maybe[list[jgdv.Frame]])

Return type:

jgdv.Maybe[jgdv.Traceback]

frames: list[jgdv.Frame] = []