Documentation
¶
Index ¶
- Variables
- func PrintChain(err error)
- func Root(err error) error
- type DetailedError
- func (e *DetailedError) Cause() error
- func (e *DetailedError) Err(err error) *DetailedError
- func (e *DetailedError) Error() string
- func (e *DetailedError) Errorf(format string, a ...any) *DetailedError
- func (e *DetailedError) Msg(msg string) *DetailedError
- func (e *DetailedError) Msgf(format string, a ...any) *DetailedError
- func (e *DetailedError) Op() Op
- func (e *DetailedError) Unwrap() error
- type Error
- type Op
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = stderr.New("Not found")
ErrNotFound is a non-domain-specific sentinel error for when a value is not found.
Functions ¶
func PrintChain ¶ added in v0.0.10
func PrintChain(err error)
func Root ¶ added in v0.0.7
Root returns the root cause error in an error chain.
It repeatedly unwraps the provided error using errors.Unwrap until there is no further wrapped error. If err is nil, Root returns nil. If the error chain contains a cycle (which should be rare), Root will stop at the last unique error before the cycle to avoid an infinite loop.
Types ¶
type DetailedError ¶
type DetailedError struct {
// contains filtered or unexported fields
}
func AsDetailedError ¶
func AsDetailedError(err error) (*DetailedError, bool)
AsDetailedError attempts to cast the given error to a DetailedError instance.
func New ¶
func New(op Op) *DetailedError
New creates a new error with the given Op and a default message: "Internal system error." The Cause is set to nil.
func (*DetailedError) Cause ¶
func (e *DetailedError) Cause() error
Cause returns the cause of a DetailedError instance.
func (*DetailedError) Err ¶
func (e *DetailedError) Err(err error) *DetailedError
Err sets the cause for a DetailedError instance.
func (*DetailedError) Error ¶
func (e *DetailedError) Error() string
Error implements the error interface.
func (*DetailedError) Errorf ¶
func (e *DetailedError) Errorf(format string, a ...any) *DetailedError
Errorf formats the error message for a DetailedError instance.
Syntactically the same as fmt.Errorf.
func (*DetailedError) Msg ¶
func (e *DetailedError) Msg(msg string) *DetailedError
Msg sets the human-readable error message for a DetailedError instance.
func (*DetailedError) Msgf ¶ added in v0.0.5
func (e *DetailedError) Msgf(format string, a ...any) *DetailedError
func (*DetailedError) Op ¶ added in v0.0.4
func (e *DetailedError) Op() Op
Op returns the operation identifier associated with this error.
func (*DetailedError) Unwrap ¶ added in v0.0.3
func (e *DetailedError) Unwrap() error
Unwrap provides compatibility with the errors.Unwrap function.