njs_errors

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelAllErrorCode

func DelAllErrorCode()

DelAllErrorCode Clean the complete list of couple code - error

func DelErrorCode

func DelErrorCode(code string)

DelErrorCode Remove an error with code from the register list

func SetErrorCode

func SetErrorCode(code string, err ErrorType)

SetErrorCode Register a new error with code and an error string as ErrorType

func SetErrorCodeString

func SetErrorCodeString(code, err string)

SetErrorCodeString Register a new error with code and an error string as string

Types

type ErrorCode

type ErrorCode interface {
	Error() error
	ErrorFull() error

	String() string
	StringFull() string

	Code() string
	Trace() runtime.Frame
}

func GetErrorCode

func GetErrorCode(code string, origin error) ErrorCode

GetErrorCode return an ErrorCode interface mapped to code given in parameters. If the code is not found an 'ERR_UNKNOWN' will be used instead of the awaiting error If an origin error is given in params, this origin error will be used in the reference of generated error or string

func GetTraceErrorCode added in v1.0.2

func GetTraceErrorCode(code string, origin error) ErrorCode

GetTraceErrorCode return an ErrorCode interface mapped to given params code. If the code is not found an 'ERR_UNKNOWN' will be used instead of the awaiting error If an origin error is given in params, this origin error will be used in the reference of generated error or string This function add a trace of error generated

type ErrorType

type ErrorType string
const ERR_UNKNOWN ErrorType = "unknown error"

func (ErrorType) Error

func (e ErrorType) Error(origin error) error

Error return an error type of the current ErrorType If an origin error is given (and not nil), this origin error will be append of the string (comma separated)

func (ErrorType) String

func (e ErrorType) String() string

String return the string form of the current ErrorType

Jump to

Keyboard shortcuts

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