Documentation ¶
Index ¶
- Constants
- func ExistInMapMessage(code CodeError) bool
- func GetCodePackages(rootPackage string) map[CodeError]string
- func GetDefaultGlue() string
- func GetDefaultPattern() string
- func GetDefaultPatternTrace() string
- func RegisterIdFctMessage(minCode CodeError, fct Message)
- func SetDefaultGlue(glue string)
- func SetDefaultPattern(pattern string)
- func SetDefaultPatternTrace(patternTrace string)
- func SetModeReturnError(mode ErrorMode)
- func SetTracePathFilter(path string)
- type CodeError
- func (c CodeError) Error(p Error) Error
- func (c CodeError) ErrorParent(p ...error) Error
- func (c CodeError) GetInt() int
- func (c CodeError) GetMessage() string
- func (c CodeError) GetString() string
- func (c CodeError) GetUint16() uint16
- func (c CodeError) IfError(e Error) Error
- func (c CodeError) Iferror(e error) Error
- type DefaultReturn
- func (r *DefaultReturn) AddParent(code int, msg string, file string, line int)
- func (r DefaultReturn) GinTonicAbort(ctx *gin.Context, httpCode int)
- func (r DefaultReturn) GinTonicErrorAbort(ctx *gin.Context, httpCode int)
- func (r DefaultReturn) JSON() []byte
- func (r *DefaultReturn) SetError(code int, msg string, file string, line int)
- type Error
- type ErrorMode
- type Message
- type Return
- type ReturnError
Constants ¶
const ( MinPkgArchive = 100 MinPkgArtifact = 200 MinPkgCertificate = 300 MinPkgCluster = 400 MinPkgConfig = 500 MinPkgConsole = 800 MinPkgCrypt = 900 MinPkgDatabase = 1000 MinPkgFTPClient = 1100 MinPkgHttpCli = 1200 MinPkgHttpServer = 1300 MinPkgIOUtils = 1400 MinPkgLDAP = 1500 MinPkgLogger = 1600 MinPkgMail = 1700 MinPkgMailer = 1800 MinPkgMailPooler = 1900 MinPkgNetwork = 2000 MinPkgNats = 2100 MinPkgNutsDB = 2200 MinPkgOAuth = 2300 MinPkgAws = 2400 MinPkgRequest = 2500 MinPkgRouter = 2600 MinPkgSemaphore = 2700 MinPkgSMTP = 2800 MinPkgStatic = 2900 MinPkgVersion = 3000 MinPkgViper = 3100 MinAvailable = 4000 // MIN_AVAILABLE @Deprecated use MinAvailable constant MIN_AVAILABLE = MinAvailable )
const NUL_MESSAGE = ""
const NullMessage = ""
const UNK_MESSAGE = "unknown error"
const UnknownMessage = "unknown error"
Variables ¶
This section is empty.
Functions ¶
func ExistInMapMessage ¶
func GetCodePackages ¶ added in v1.5.1
func GetDefaultGlue ¶
func GetDefaultGlue() string
GetDefaultGlue return the current glue used to joins errors with parents.
func GetDefaultPattern ¶
func GetDefaultPattern() string
GetDefaultPattern return the current pattern used for string of error with code. The pattern is fmt pattern with 2 inputs in order : code, message.
func GetDefaultPatternTrace ¶
func GetDefaultPatternTrace() string
GetDefaultPatternTrace return the current pattern used for string of error with code and trace. The pattern is fmt pattern with 3 inputs in order : code, message, trace.
func RegisterIdFctMessage ¶
func SetDefaultGlue ¶
func SetDefaultGlue(glue string)
SetTracePathFilter define the glue string to be used to join main error with parents'errors.
func SetDefaultPattern ¶
func SetDefaultPattern(pattern string)
GetDefaultPatternTrace define the pattern to be used for string of error with code. The pattern is fmt pattern with 2 inputs in order : code, message.
func SetDefaultPatternTrace ¶
func SetDefaultPatternTrace(patternTrace string)
SetDefaultPatternTrace define the pattern to be used for string of error with code and trace. The pattern is fmt pattern with 3 inputs in order : code, message, trace.
func SetModeReturnError ¶
func SetModeReturnError(mode ErrorMode)
func SetTracePathFilter ¶ added in v1.3.0
func SetTracePathFilter(path string)
SetTracePathFilter customize the filter apply to filepath on trace.
Types ¶
type CodeError ¶
type CodeError uint16
const UNK_ERROR CodeError = 0
const UnknownError CodeError = 0
func (CodeError) ErrorParent ¶
func (CodeError) GetMessage ¶
type DefaultReturn ¶ added in v1.5.0
func NewDefaultReturn ¶ added in v1.5.0
func NewDefaultReturn() *DefaultReturn
func (*DefaultReturn) AddParent ¶ added in v1.5.0
func (r *DefaultReturn) AddParent(code int, msg string, file string, line int)
func (DefaultReturn) GinTonicAbort ¶ added in v1.5.0
func (r DefaultReturn) GinTonicAbort(ctx *gin.Context, httpCode int)
func (DefaultReturn) GinTonicErrorAbort ¶ added in v1.5.0
func (r DefaultReturn) GinTonicErrorAbort(ctx *gin.Context, httpCode int)
func (DefaultReturn) JSON ¶ added in v1.5.0
func (r DefaultReturn) JSON() []byte
type Error ¶
type Error interface { //IsCodeError check if the given error code is matching with the current Error IsCodeError(code CodeError) bool //HasCodeError check if current error or parent has the given error code HasCodeError(code CodeError) bool //GetCodeError return the CodeError value of the current error GetCodeError() CodeError //GetCodeErrorParent return a slice of CodeError value of all parent Error and the code of the current Error GetCodeErrorParent() []CodeError //IsError check if the given error params is a valid error and not a nil pointer IsError(e error) bool //HasError check if the given error in params is still in parent error HasError(err error) bool //HasParent check if the current Error has any valid parent HasParent() bool //AddParent will add all no empty given error into parent of the current Error pointer AddParent(parent ...error) //SetParent will replace all parent with the given error list SetParent(parent ...error) //AddParentError will add all no empty given Error into parent of the current Error pointer AddParentError(parent ...Error) //SetParentError will replace all parent with the given Error list SetParentError(parent ...Error) //Code is used to return the code of current Error, as string Code() string //CodeFull is used to return a joint string of code of current Error and code of all parent Error CodeFull(glue string) string //CodeSlice is used to return a slice string of all code of current Error (main and parent) CodeSlice() []string //CodeError is used to return a composed string of current Error code with message, for current Error and no parent CodeError(pattern string) string //CodeErrorFull is used to return a composed string of couple error code with message, for current Error and all parent CodeErrorFull(pattern, glue string) string //CodeErrorSlice is used to return a composed string slice of couple error code with message, for current Error and all parent CodeErrorSlice(pattern string) []string //CodeErrorTrace is used to return a composed string of current Error code with message and trace information, for current Error and no parent CodeErrorTrace(pattern string) string //CodeErrorTraceFull is used to return a composed string of couple error code with message and trace information, for current Error and all parent CodeErrorTraceFull(pattern, glue string) string //CodeErrorTraceSlice is used to return a composed string slice of couple error code with message and trace information, for current Error and all parent CodeErrorTraceSlice(pattern string) []string //Error is used to match with error interface //this function will return a mixed result depends of the configuration defined by calling SetModeReturnError Error() string //StringError is used to return the error message, for current Error and no parent StringError() string //StringErrorFull is used to return the error message, for current Error and all parent StringErrorFull(glue string) string //StringErrorSlice is used to return the error message, for current Error and all parent, as a slice of string StringErrorSlice() []string //GetError is used to return a new error interface based of the current error (and no parent) GetError() error //GetErrorFull is used to return a new error interface based of the current error with all parent GetErrorFull(glue string) error //GetErrorSlice is used to return a slice of new error interface, based of the current error and all parent GetErrorSlice() []error //GetIError is used to return a Error interface pointer based of current Error GetIError() Error //GetIErrorSlice is used to return a slice of Error interface pointer, based of current Error and all parents GetIErrorSlice() []Error //GetTrace will return a comped string for the trace of the current Error GetTrace() string //GetTrace will return a slice of comped string fpr the trace of the current Error and all parent GetTraceSlice() []string //Return will transform the current Error into a given pointer that implement the Return interface Return(r Return) //ReturnError will send the current Error value to the given function ReturnError ReturnError(f ReturnError) //ReturnParent will send all parent information of the current Error value to the given function ReturnError ReturnParent(f ReturnError) }