errors

package
v0.0.0-...-c18a219 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 3 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotImplemented = serrors.New("not implemented")
	NotSupported   = serrors.New("not supported")
)

Functions

func Cause

func Cause(err error) error

Cause returns the underlying cause of the error, if possible. An error value has a cause if it implements `Causer` interface. If the error does not implement Cause, the original error will be returned.

func Convert

func Convert(e interface{}) error

Convert convert e to an error.

func Format

func Format(format string, args ...interface{}) error

Format formats according to a format specifier and returns the string as a value that satisfies error.

func New

func New(text string) error

New returns an error that formats as the given text.

func Stack

func Stack(err error) error

Stack returns an error appends with stack.

func Wrap

func Wrap(err error, msg string, args ...interface{}) error

Wrap wraps an error as a new one.

Types

type Causer

type Causer interface {
	Cause() error
}

type CodedError

type CodedError struct {
	Code    int32  `json:"code"`
	Message string `json:"message,omitempty"`
	Detail  string `json:"detail,omitempty"`
}

func Coded

func Coded(code int32, msg string, detail ...string) *CodedError

Coded return an coded error.

func (*CodedError) Error

func (e *CodedError) Error() string

type ListError

type ListError []error

func List

func List(errs ...error) ListError

List returns an error which wraps multiple errors

func (ListError) Error

func (e ListError) Error() string

Jump to

Keyboard shortcuts

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