Documentation ¶
Index ¶
- Variables
- type BaseError
- type BaseErrorType
- func (t *BaseErrorType) Derive() ErrorType
- func (t *BaseErrorType) DeriveWithCode(code uint) ErrorType
- func (t *BaseErrorType) GetCode() ErrorCode
- func (t *BaseErrorType) New(message string) Error
- func (t *BaseErrorType) Newf(format string, args ...interface{}) Error
- func (t *BaseErrorType) SetPreNewError(preFunc PreErrorTypeFunc)
- func (t *BaseErrorType) String() string
- func (t *BaseErrorType) TypeOf(err ErrorType) bool
- type Error
- type ErrorCode
- type ErrorType
- type PreErrorTypeFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //RuntimeError a global error that is categorized as runtime error RuntimeError = _BASE_ERROR.Derive() //ClientError represent any error due to client input ClientError = RuntimeError.Derive() //InternalError represent any error that happen because of server problem //Comes pre setup with a stack trace generated InternalError = RuntimeError.Derive() )
Functions ¶
This section is empty.
Types ¶
type BaseError ¶
type BaseError struct {
// contains filtered or unexported fields
}
BaseError represent an error message
type BaseErrorType ¶
type BaseErrorType struct {
// contains filtered or unexported fields
}
BaseErrorType for handling further error
func (*BaseErrorType) Derive ¶
func (t *BaseErrorType) Derive() ErrorType
Derive a new BaseErrorType from this error type
func (*BaseErrorType) DeriveWithCode ¶ added in v1.3.0
func (t *BaseErrorType) DeriveWithCode(code uint) ErrorType
Derive a new BaseErrorType from this error type
func (*BaseErrorType) GetCode ¶
func (t *BaseErrorType) GetCode() ErrorCode
GetCode return current error code
func (*BaseErrorType) New ¶
func (t *BaseErrorType) New(message string) Error
New instance of Error with this given type
func (*BaseErrorType) Newf ¶
func (t *BaseErrorType) Newf(format string, args ...interface{}) Error
Newf instance of formatted error
func (*BaseErrorType) SetPreNewError ¶ added in v1.2.0
func (t *BaseErrorType) SetPreNewError(preFunc PreErrorTypeFunc)
SetPreNewError will be executed before the created error returned
func (*BaseErrorType) String ¶
func (t *BaseErrorType) String() string
String represent struct as string of error code
func (*BaseErrorType) TypeOf ¶
func (t *BaseErrorType) TypeOf(err ErrorType) bool
TypeOf check wheter current error is subtype of [err] return true if valid
type Error ¶
type Error interface { TypeOf(err ErrorType) bool Error() string GetCode() ErrorCode // contains filtered or unexported methods }
Error base interface for suberror's error
type ErrorType ¶
type ErrorType interface { TypeOf(err ErrorType) bool New(message string) Error Newf(message string, args ...interface{}) Error GetCode() ErrorCode Derive() ErrorType DeriveWithCode(code uint) ErrorType SetPreNewError(preFunc PreErrorTypeFunc) // contains filtered or unexported methods }
ErrorType represent error type
type PreErrorTypeFunc ¶ added in v1.2.0
type PreErrorTypeFunc func(err Error)
Click to show internal directories.
Click to hide internal directories.