Documentation
¶
Index ¶
- Variables
- type Stack
- func (s *Stack) Attach(errs ...error) *Stack
- func (s *Stack) Copy() *Stack
- func (s *Stack) Empty() bool
- func (s *Stack) Error() string
- func (s *Stack) Find(err error, max int) []int
- func (s *Stack) First(err error) int
- func (s *Stack) FirstStack(err *Stack) int
- func (s *Stack) Format(state fmt.State, verb rune)
- func (s *Stack) Get(level int) error
- func (s *Stack) Has(err error) bool
- func (s *Stack) HasStack(err *Stack) bool
- func (s *Stack) Is(err error) bool
- func (s *Stack) IsStack(err *Stack) bool
- func (s *Stack) Last() error
- func (s *Stack) Level() int
- func (s *Stack) MarshalJSON() ([]byte, error)
- func (s *Stack) Pop(errs []error) *Stack
- func (s *Stack) Push(errs ...error) *Stack
- func (s *Stack) Root() error
- func (s *Stack) Walk(walkFn WalkFunc) error
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
var ErrSkip = errors.New("skip this error")
ErrSkip is used as a return value from WalkFuncs to indicate that the error in the call is to be skipped. It is not returned as an error by any function.
Functions ¶
This section is empty.
Types ¶
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack is a stack of error.
func (*Stack) Find ¶
Find gets the level of given error appears within the first max times. If max < 0, there is no limit on the number of times. If not found, will return empty array.
An error is considered to match a target if it is equal to that target or if it implements a method Is(error) bool such that Is(target) returns true.
func (*Stack) First ¶
First gets the first level of given error appears. If not found, will return 0.
func (*Stack) FirstStack ¶ added in v0.2.1
FirstStack gets the first level of given error stack appears. If not found, will return 0.
func (*Stack) HasStack ¶ added in v0.2.1
HasStack reports whether the error stack contains given error stack.
func (*Stack) IsStack ¶ added in v0.2.1
IsStack reports whether the error stack is given error stack.
func (*Stack) Level ¶
Level gets the total level of the error stack has. If the stack is empty, will return 0.
func (*Stack) MarshalJSON ¶ added in v0.4.0
MarshalJSON is the implementation of JSON marshaler.