Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flaw ¶
type Flaw struct { // Inner is the error string that was passed in during initialization. Inner string // JoinedErrors is the list of optional (nil-able) errors // joined into the error while traversing the stack back, // usually in the same function initiated the error. JoinedErrors []JoinedError // Records contains contextual information in order the error traversed the stack up, // i.e., the first item in the slice is the first record attached to the error, // and the last item is the most recent attached record. Records []Record StackTrace []StackTrace }
func From ¶
From creates a Flaw instance from an existing error. You can append contextual information to it using the Flaw.Append function immediately after instantiation, or by the caller function, after making sure the returned error is of type Flaw (using errors.As), It panics if err is nil.
func (*Flaw) Append ¶
Append appends contextual information to Flaw instance. It can be called immediately after instantiation using From, or by the parent caller function, after making sure the returned error is of type Flaw (using errors.As). It panics if payload is nil. Elements in payloads will be merged into payload in order they are provided, thus duplicate keys will be overwritten.
func (*Flaw) Error ¶
Error satisfies builtin error interface type. It returns the inner error string.
type JoinedError ¶ added in v8.2.0
type JoinedError struct { // Message is the result of joined error Error method call. Message string // CallerStackTrace is the error generator stack trace, // which in a very rare case can be nil. See [runtime.CallersFrames], // and [runtime.Callers] for more information on when this might happen. CallerStackTrace *StackTrace }
type StackTrace ¶
type StackTrace struct { // Line is the file line number of the location in this frame. // For non-leaf frames, this will be the location of a call. // This may be zero, if not known. Line int // File is the file name of the location in this frame. // For non-leaf frames, this will be the location of a call. // This may be the empty string if not known. File string // Function is the package path-qualified function name of // this call frame. If non-empty, this string uniquely // identifies a single function in the program. // This may be the empty string if not known. Function string }