Documentation
¶
Overview ¶
Package errappend provides an interface for error types that want to provide a custom error message when appended to a byte slice.
Example ¶
err := errbase.New("error")
b := Append(nil, err)
fmt.Println(string(b))
Output: error
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append appends the error message of the given error to the given byte slice and returns the resulting byte slice. If the given error is nil, the given byte slice is returned unchanged. If the given error implements the Interface interface, its Interface.ErrorAppend method is called to append the error message to the byte slice. Otherwise, the error message is appended to the byte slice using the [error.Error] method.
Types ¶
Click to show internal directories.
Click to hide internal directories.