errors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error interface {
	Error() string

	Severity() Severity
}

Error is a custom error interface used which also includes the sevirity of the error.

type MultiError

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

MultiError is a type to handle multiples errors simultaneously.

func NewMultiError

func NewMultiError() *MultiError

NewMultiError returns a new instance of MultiError type.

func (*MultiError) Append

func (m *MultiError) Append(err error)

Append appends the error with the multierror using the default serverity of Error

func (*MultiError) AppendWithSeverity

func (m *MultiError) AppendWithSeverity(err error, severity Severity)

AppendWithSeverity appends the error with the multierror using the provided severity

func (*MultiError) Error

func (m *MultiError) Error() string

Error is implemented to be categorized as an error.

func (*MultiError) GetError

func (m *MultiError) GetError() error

GetError returns the multi error itself if the severity of any one of the message is error, else it returns nil.

func (*MultiError) HasErrors

func (m *MultiError) HasErrors() bool

HasErrors returns if any of the errors has severity error

func (*MultiError) Severity

func (m *MultiError) Severity() Severity

Severity returns the sevirity of the multierror type by selecting the highest severity among the given.

func (*MultiError) String

func (m *MultiError) String() string

String returns the string representation of multiple errors

type Severity

type Severity string

Severity type describes the sevierty of any message.

var (
	// SeverityTypeWarn is for warnings
	SeverityTypeWarn Severity = "warn"

	// SeverityTypeError is for errors
	SeverityTypeError Severity = "error"

	// SeverityTypeInfo is for information
	SeverityTypeInfo Severity = "info"
)

Jump to

Keyboard shortcuts

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