errutil

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package errutil provides utilty of errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiError

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

MultiError has multipule errors in internal and can show all of these

func NewMultiError

func NewMultiError() *MultiError

Constract with no argument.

func (*MultiError) Add

func (me *MultiError) Add(err error)

Add given error into Internal. if error is nil, no action for internal errors.

func (*MultiError) Err

func (me *MultiError) Err() error

Err returns internal errors joined to one error. if internal errors is nothing, return nil.

type Reader

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

Reader is wrapper of io.Reader with internal error.

func NewErrReader

func NewErrReader(r io.Reader) *Reader

func (Reader) Err

func (er Reader) Err() error

func (*Reader) Read

func (er *Reader) Read(p []byte) (int, error)

type Writer

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

Writer is wraper of io.Writer with internal Error. if call Write(), error is remaindered in internal, and trailing Write() is not executed.

func NewErrWriter

func NewErrWriter(w io.Writer) *Writer

construct with io.Writer.

func (Writer) Err

func (ew Writer) Err() error

return internal error.

func (*Writer) Write

func (ew *Writer) Write(p []byte) (int, error)

Write binds error of Write() to internal. if internal err is not nil, after write process is ignored

Jump to

Keyboard shortcuts

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