errutil

package module
v0.0.0-...-911db42 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

Package errutil provides utility functions related to error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Print

func Print(err error) bool

Print prints error if given error is not ni, and returns true.

Types

type ErrorStack

type ErrorStack struct {
	Errors []error
}

ErrorStack contains multiple non-nil errors.

func NewErrorStack

func NewErrorStack(err error) *ErrorStack

NewErrorStack creates new ErrorStack. if given error is not nil, it will pushed.

func (*ErrorStack) Clear

func (e *ErrorStack) Clear()

Clear removes all errors.

func (*ErrorStack) First

func (e *ErrorStack) First() error

First returns first pushed non-nil error.

func (*ErrorStack) Push

func (e *ErrorStack) Push(err error)

Push pushes given error to stack if not nil.

func (*ErrorStack) PushBool

func (e *ErrorStack) PushBool(b bool, str string)

PushBool pushes new error with given string if given bool is true.

Jump to

Keyboard shortcuts

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