errors

package
v0.0.0-...-4970bd5 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: GPL-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler use for checking error

func New

func New() *Handler

Create error handler

func (*Handler) And

func (h *Handler) And(errs ...error) *Handler

And will add error to handler

func (*Handler) AndD

func (h *Handler) AndD(data interface{}, err error) (interface{}, *Handler)

AndD will help user to not need variable for checking error For example if method return (string, error) instead create variable and pass only error to And method you can pass entirely to this function and use error handler to handle error instead

func (*Handler) Error

func (h *Handler) Error() error

Error will convert handler to error if handler contains any error

func (*Handler) Exit

func (h *Handler) Exit(n int)

Exit will exit the program if handler contain any error

func (*Handler) Exit1

func (h *Handler) Exit1()

Same as Exit but always return exit code 1

func (*Handler) First

func (h *Handler) First() error

First will get the first error in handler

func (*Handler) HasError

func (h *Handler) HasError() bool

HasError will check whether handler has error or not

func (*Handler) Length

func (h *Handler) Length() int

Length will get length of errors

func (*Handler) Merge

func (h *Handler) Merge(nh *Handler) *Handler

Merge will merge error to handler

func (*Handler) Panic

func (h *Handler) Panic()

Panic program if error

func (*Handler) String

func (h *Handler) String() string

String use for converting object data to string

func (*Handler) Total

func (h *Handler) Total() int

Total will get number of errors

Jump to

Keyboard shortcuts

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