Skip to content

Error Trace Rt

Spice
import "std/runtime/error_trace_rt";

ErrorTraceBuffer struct

Fixed-capacity backing store for one thread's error return trace. Always accessed through the thread-local instance __err_trace_buffer() hands back - never instantiated directly from Spice source.

Methods

reset

Spice
public p ErrorTraceBuffer.reset(string originLoc)

Starts a fresh trace with the given location as its origin (frame 0).

Parameters

Name Type Description
originLoc string

push

Spice
public p ErrorTraceBuffer.push(string hopLoc)

Appends a propagation hop to the current trace. A no-op if no origin has been recorded yet. Once the capacity above is hit, further hops are silently dropped, keeping the origin and the earliest hops rather than the most recent ones - a real propagation chain this deep is expected to be exceedingly rare.

Parameters

Name Type Description
hopLoc string

dump

Spice
public p ErrorTraceBuffer.dump()

Prints every recorded frame. A no-op if there is no active trace.

Functions

_spice_errTraceReset

Spice
public p _spice_errTraceReset(string originLoc)

Starts a fresh trace with the given location as its origin (frame 0).

Parameters

Name Type Description
originLoc string

_spice_errTracePush

Spice
public p _spice_errTracePush(string hopLoc)

Appends a propagation hop to the current trace.

Parameters

Name Type Description
hopLoc string

_spice_errTraceDump

Spice
public p _spice_errTraceDump()

Prints every recorded frame of the current thread's trace. A no-op if there is no active trace, which also covers the case where error return tracing was never enabled anywhere along the propagation chain in the first place - callers don't need to check that separately (see Error.dumpTrace() and panic()'s own wiring, both of which call this unconditionally).