errors

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package errors contains neuron error structure definitions. It is used to create new errors based on classes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNoResult added in v0.2.3

func IsNoResult(err error) bool

IsNoResult checks if the provided model is the *Error instance with the class.QueryValueNoResult.

Types

type Error added in v0.2.1

type Error struct {
	// ID is a unique error instance identification number.
	ID uuid.UUID

	// Class defines the error classification.
	Class class.Class

	// Detail contains the detailed information.
	Detail string

	// Message is a message used as a string for the
	// golang error interface implementation.
	Message string

	// Opertaion is the operation name when the error occurred.
	Operation string
}

Error is the common error definition used in the neuron project.

func New added in v0.2.1

func New(c class.Class, message string) *Error

New creates new error message with given 'class' and message 'message'.

func Newf added in v0.2.1

func Newf(c class.Class, format string, args ...interface{}) *Error

Newf creates new error instance with provided 'class' with formatted message.

func (*Error) Error added in v0.2.1

func (e *Error) Error() string

Error implements error interface.

func (*Error) SetClass added in v0.2.1

func (e *Error) SetClass(c class.Class) *Error

SetClass sets the error Class 'c' and returns itself.

func (*Error) SetDetail added in v0.2.1

func (e *Error) SetDetail(detail string) *Error

SetDetail sets the error 'detail' and returns itself.

func (*Error) SetDetailf added in v0.2.1

func (e *Error) SetDetailf(format string, args ...interface{}) *Error

SetDetailf sets the error's formatted detail with provided and returns itself.

func (*Error) SetOperation added in v0.2.1

func (e *Error) SetOperation(operation string) *Error

SetOperation sets the error's operation and returns error by itself.

func (*Error) WrapDetail added in v0.2.1

func (e *Error) WrapDetail(detail string) *Error

WrapDetail wraps the 'detail' for given error. Wrapping appends the new detail to the front of error detail message.

func (*Error) WrapDetailf added in v0.2.1

func (e *Error) WrapDetailf(format string, args ...interface{}) *Error

WrapDetailf wraps the detail with provided formatting for given error. Wrapping appends the new detail to the front of error detail message.

type MultiError added in v0.2.1

type MultiError []*Error

MultiError is the slice of errors parsable into a single error.

func (MultiError) Error added in v0.2.1

func (m MultiError) Error() string

Error implements error interface.

func (MultiError) HasMajor added in v0.2.1

func (m MultiError) HasMajor(major class.Major) bool

HasMajor checks if provided 'major' occurs in given multi error slice.

Directories

Path Synopsis
Package class contains neuron error classification system.
Package class contains neuron error classification system.

Jump to

Keyboard shortcuts

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