Documentation ¶
Index ¶
- Constants
- func ContainsString(e error, s string) bool
- func ConvPathFromLocal(str string) string
- func ExistInMapMessage(code CodeError) bool
- func GetCodePackages(rootPackage string) map[CodeError]string
- func GetDefaultPattern() string
- func GetDefaultPatternTrace() string
- func Has(e error, code CodeError) bool
- func Is(e error) bool
- func IsCode(e error, code CodeError) bool
- func RegisterIdFctMessage(minCode CodeError, fct Message)
- func SetDefaultPattern(pattern string)
- func SetDefaultPatternTrace(patternTrace string)
- func SetModeReturnError(mode ErrorMode)
- func SetTracePathFilter(path string)
- type CodeError
- 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
- func AddOrNew(errMain, errSub error, parent ...error) Error
- func Get(e error) Error
- func IfError(code uint16, message string, parent ...error) Error
- func Make(e error) Error
- func MakeIfError(err ...error) Error
- func New(code uint16, message string, parent ...error) Error
- func NewErrorRecovered(msg string, recovered string, parent ...error) Error
- func NewErrorTrace(code int, msg string, file string, line int, parent ...error) Error
- type ErrorMode
- type Errors
- type FuncMap
- type Message
- type Return
- type ReturnError
- type ReturnGin
Constants ¶
const ( MinPkgArchive = baseInc + iota MinPkgArtifact = baseInc + MinPkgArchive MinPkgCertificate = baseInc + MinPkgArtifact MinPkgCluster = baseInc + MinPkgCertificate MinPkgConfig = baseInc + MinPkgCluster MinPkgConsole = moreInc + MinPkgConfig MinPkgCrypt = baseInc + MinPkgConsole MinPkgDatabaseGorm = baseInc + MinPkgCrypt MinPkgDatabaseKVDrv = baseSub + MinPkgDatabaseGorm MinPkgDatabaseKVMap = baseSub + MinPkgDatabaseKVDrv MinPkgDatabaseKVTbl = baseSub + MinPkgDatabaseKVMap MinPkgDatabaseKVItm = baseSub + MinPkgDatabaseKVTbl MinPkgFileProgress = baseInc + MinPkgDatabaseGorm MinPkgFTPClient = baseInc + MinPkgFileProgress MinPkgHttpCli = baseInc + MinPkgFTPClient MinPkgHttpCliDNSMapper = baseSub + MinPkgHttpCli MinPkgHttpServer = baseInc + MinPkgHttpCliDNSMapper MinPkgHttpServerPool = baseSub + MinPkgHttpServer MinPkgIOUtils = baseInc + MinPkgHttpServer MinPkgLDAP = baseInc + MinPkgIOUtils MinPkgLogger = baseInc + MinPkgLDAP MinPkgMail = baseInc + MinPkgLogger MinPkgMailer = baseInc + MinPkgMail MinPkgMailPooler = baseInc + MinPkgMailer MinPkgMonitor = baseInc + MinPkgMailPooler MinPkgMonitorCfg = baseSub + MinPkgMonitor MinPkgMonitorPool = baseSub + MinPkgMonitorCfg MinPkgNetwork = baseInc + MinPkgMonitor MinPkgNats = baseInc + MinPkgNetwork MinPkgNutsDB = baseInc + MinPkgNats MinPkgOAuth = baseInc + MinPkgNutsDB MinPkgAws = baseInc + MinPkgOAuth MinPkgRequest = baseInc + MinPkgAws MinPkgRouter = baseInc + MinPkgRequest MinPkgSemaphore = baseInc + MinPkgRouter MinPkgSMTP = baseInc + MinPkgSemaphore MinPkgSMTPConfig = baseInc + MinPkgSMTP MinPkgStatic = baseInc + MinPkgSMTPConfig MinPkgStatus = baseInc + MinPkgStatic MinPkgSocket = baseInc + MinPkgStatus MinPkgVersion = baseInc + MinPkgSocket MinPkgViper = baseInc + MinPkgVersion MinAvailable = baseInc + MinPkgViper )
const NullMessage = ""
const (
PathSeparator = "/"
)
const UnknownMessage = "unknown error"
Variables ¶
This section is empty.
Functions ¶
func ContainsString ¶ added in v1.12.0
func ConvPathFromLocal ¶ added in v1.9.17
func ExistInMapMessage ¶
func GetCodePackages ¶ added in v1.5.1
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 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 UnknownError CodeError = 0
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 { //IsCode check if the given error code is matching with the current Error IsCode(code CodeError) bool //HasCode check if current error or parent has the given error code HasCode(code CodeError) bool //GetCode return the CodeError value of the current error GetCode() CodeError //GetParentCode return a slice of CodeError value of all parent Error and the code of the current Error GetParentCode() []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 //GetParent return a slice of Error interface for each parent error with or without the first error. GetParent(withMainError bool) []error //Map run a function on each func and parent. If the function return false, the loop stop. Map(fct FuncMap) bool //ContainsString return true if any message into the main error or the parent message error contains the given part string ContainsString(s string) bool //Add will add all no empty given error into parent of the current Error pointer Add(parent ...error) //SetParent will replace all parent with the given error list SetParent(parent ...error) //Code is used to return the code of current Error, as string Code() uint16 //CodeSlice is used to return a slice string of all code of current Error (main and parent) CodeSlice() []uint16 //CodeError is used to return a composed string of current Error code with message, for current Error and no parent CodeError(pattern 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 //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 //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 //GetErrorSlice is used to return a slice of new error interface, based of the current error and all parent GetErrorSlice() []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) }