richerrors

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRichError added in v0.0.4

func IsRichError(err error) bool

IsRichError checks if the error wraps a RichError.

Types

type Error

type Error struct {
	Code        int
	ExternalMsg string
	Err         error
}

Error is an error that contains a code, an external message, and a wrapped error.

func AsRichError added in v0.0.4

func AsRichError(err error) (Error, bool)

AsRichError unwraps the error if it wraps a RichError.

func ErrorWithCodef

func ErrorWithCodef(code int, externalMsg string, format string, args ...interface{}) Error

func Errorf

func Errorf(externalMsg string, format string, args ...interface{}) Error

Errorf creates a new RichError with the given external message and format.

func (Error) Error

func (e Error) Error() string

Error returns the ExternalMsg if it is set, otherwise it returns the error message of the wrapped error.

func (Error) MarshalText

func (e Error) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (Error) String

func (e Error) String() string

String implements the fmt.Stringer interface.

func (*Error) UnmarshalText

func (e *Error) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Error) Unwrap

func (e Error) Unwrap() error

Unwrap returns the wrapped error to support errors.Is and errors.As.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL