Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStackTraces ¶
func GetStackTraces(err error) iter.Seq2[error, StackTrace]
GetStackTraces returns a sequence of errors and their associated StackTrace.
This function recursively returns errors and stack traces by repeating the following process:
1. If the given error has a StackTrace itself, this function returns the wrapped error and its StackTrace
- In this case, the iterator returns only one error.
2. If the given error has an Unwrap() error function, this function calls it and tries to process step 1 again 3. If the given error has an Unwrap() []error function, this function calls it and tries to process step 1 for each error in the returned slice
Types ¶
type StackTrace ¶
type StackTrace []Frame
func GetAttachedStackTrace ¶
func GetAttachedStackTrace(err error) (StackTrace, bool)
GetAttachedStackTrace returns the StackTrace if the given error has one.
The returned bool indicates whether the given error has a StackTrace.
func GetCurrentStackTrace ¶
func GetCurrentStackTrace() StackTrace
GetCurrentStackTrace returns the current StackTrace.
func GetStackTrace ¶
func GetStackTrace(err error) StackTrace
GetStackTrace returns a StackTrace for err.
If err does not have a StackTrace, this function creates the current StackTrace.
Also, if err is nil, this function returns nil.
func (StackTrace) AppendText ¶
func (st StackTrace) AppendText(ret []byte) ([]byte, error)
func (StackTrace) String ¶
func (st StackTrace) String() string