tpcp.misc.WarningErrorContextRecord#

class tpcp.misc.WarningErrorContextRecord(type: Literal['warning', 'error', 'print'], context: str, message: Warning | BaseException | str)[source]#

A warning, error, or contextual print captured by an active context.

The original warning or exception object is retained as message so its concrete type and custom attributes remain available for later inspection. Contextual prints store their unmodified rendered text.

Attributes:
type

The kind of captured event.

context

The fully rendered context stack at the time of the event.

message

The original warning or exception object, or the rendered print text.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

context: str#

Alias for field number 1

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=sys.maxsize, /)#

Return first index of value.

Raises ValueError if the value is not present.

message: Warning | BaseException | str#

Alias for field number 2

type: Literal['warning', 'error', 'print']#

Alias for field number 0