Record ErrorReportpub

Source
:record(pub) ErrorReport
  .message Str
  .cause (Option ErrorReport)
  .backtrace (Vec Str)
Description

ErrorReport wraps a message string, an optional wrapped cause (the next layer of the error chain), and an optional backtrace represented as a (Vec Str) of pre-rendered frame descriptions. The record is value-typed; every modifier returns a fresh copy.

Spec shape uses Error (existential) + (Option (Seq Frame _)); this partial uses Str + (Vec Str) pending the Error trait and Frame types.

Fields

.message Str
.cause Option(ErrorReport)
.backtrace Vec(Str)

Implementations

impl ErrorReport

.cause ( ErrorReport (Option ErrorReport) )

Accessor: return the wrapped cause, if any.

.message ( ErrorReport Str )

Accessor: return the top-level message. Equivalent to the .message record-field accessor, provided as an explicit method so callers can treat the type as opaque.

.pretty ( ErrorReport Str )

Render a multi-line pretty-printed representation of the error chain. The top-level message appears on its own line; each wrapped cause is emitted on a subsequent line prefixed with "caused by: ". When a non-empty backtrace is attached, it is appended after the chain, one frame per line, prefixed with " at ".

.with-backtrace ( ErrorReport (Vec Str) ErrorReport )

Attach a backtrace (sequence of pre-rendered frame strings). Replaces any previously attached backtrace.