errorhandler

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ErrProcessAuthenticate    = "errAuthenticate"
	ErrDbAlreadyExists        = "errDBAlreadyExists"
	ErrDbConnection           = "errDBConnection"
	ErrDbDisconnection        = "errDBDisConnection"
	ErrDbExecute              = "errDBExecute"
	ErrDbRowNotFound          = "errDBRowNotFound"
	ErrDbUpdateNoEffect       = "errDBUpdateNoEffect"
	ErrProcessExecute         = "errExecute"
	ErrGrpcConnection         = "errGRPCConnection"
	ErrGrpcExecute            = "errGRPCExecute"
	ErrProcessInvalidArgument = "errProcessInvalidArgument"
	ErrJsonMarshal            = "errJSONMarshal"
	ErrJsonUnmarshal          = "errJSONUnmarshal"
	ErrJwtExecute             = "errJWTExecute"
	ErrDataNotFound           = "errDataNotFound"
	ErrProcessPermissionDeny  = "errPermissionDeny"
	ErrProcessServerExecute   = "errServerExecute"
	ErrProcessVariable        = "errVariable"
)

Variables

View Source
var (
	ErrInWhitelist             = errors.New("in whitelist")
	ErrNoPermission            = errors.New("no permission")
	ErrUnauthenticated         = errors.New("unauthenticated")
	ErrInvalidArguments        = errors.New("invalid arguments")
	ErrNoRows                  = errors.New("no rows in result set")
	ErrAlreadyExists           = errors.New("primary key already exist")
	ErrUpdateNoEffect          = errors.New("no rows effected")
	ErrFailCloseSession        = errors.New("fail to close connection")
	ErrIncomingMetadataExist   = fmt.Errorf("%w: gRPC incoming metadata not exist", ErrInvalidArguments)
	ErrAuthorizationRequired   = fmt.Errorf("%w: metadata key: [authorization] must required", ErrInvalidArguments)
	ErrAuthorizationTypeBearer = fmt.Errorf("%w: JWT Authorization format error: must be Bearer", ErrInvalidArguments)
	ErrDeny                    = fmt.Errorf("%w: deny", ErrUnauthenticated)
	ErrNoRefreshToken          = fmt.Errorf("%w: no refresh token", ErrUnauthenticated)
	ErrExpiredToken            = fmt.Errorf("%w: token is expired", ErrUnauthenticated)
	ErrScopeNotExist           = fmt.Errorf("%w: scopes not exist", ErrInvalidArguments)
	ErrOutOfScopes             = fmt.Errorf("%w: out of scopes", ErrNoPermission)
	ErrOutOfPermissions        = fmt.Errorf("%w: out of permissions", ErrNoPermission)
)

Functions

func ErrorToChannel

func ErrorToChannel(err error, ch chan<- error)

ErrorToChannel method

func GinPanicErrorHandler

func GinPanicErrorHandler(system, prefixMessage string) func(c *gin.Context)

func PanicErrorHandler

func PanicErrorHandler(system, prefixMessage string)

func PanicGRPCErrorHandler

func PanicGRPCErrorHandler(errContent *error, system, prefixMessage string)

func PanicWaitGroupErrorHandler

func PanicWaitGroupErrorHandler(errContent *error, rmu *sync.RWMutex, wg *sync.WaitGroup)

Types

type ErrAuthenticate

type ErrAuthenticate struct {
	// contains filtered or unexported fields
}

func NewErrAuthenticate

func NewErrAuthenticate(err error) *ErrAuthenticate

func (ErrAuthenticate) Error

func (e ErrAuthenticate) Error() string

func (ErrAuthenticate) GRPCReport

func (e ErrAuthenticate) GRPCReport(errContent *error, prefixMessage string)

func (ErrAuthenticate) GetError

func (e ErrAuthenticate) GetError() error

func (ErrAuthenticate) GetName

func (e ErrAuthenticate) GetName() string

GetName method

func (ErrAuthenticate) GinReport

func (e ErrAuthenticate) GinReport(c *gin.Context)

func (ErrAuthenticate) Report

func (e ErrAuthenticate) Report(prefix string)

func (*ErrAuthenticate) SetSystem

func (e *ErrAuthenticate) SetSystem(system string) IErrorReport

type ErrDBAlreadyExists

type ErrDBAlreadyExists struct {
	// contains filtered or unexported fields
}

func NewErrDBAlreadyExists

func NewErrDBAlreadyExists(err error) *ErrDBAlreadyExists

func (ErrDBAlreadyExists) Error

func (e ErrDBAlreadyExists) Error() string

func (ErrDBAlreadyExists) GRPCReport

func (e ErrDBAlreadyExists) GRPCReport(errContent *error, prefixMessage string)

func (ErrDBAlreadyExists) GetError

func (e ErrDBAlreadyExists) GetError() error

func (ErrDBAlreadyExists) GetName

func (e ErrDBAlreadyExists) GetName() string

GetName method

func (ErrDBAlreadyExists) GinReport

func (e ErrDBAlreadyExists) GinReport(c *gin.Context)

func (ErrDBAlreadyExists) Report

func (e ErrDBAlreadyExists) Report(prefix string)

func (*ErrDBAlreadyExists) SetSystem

func (e *ErrDBAlreadyExists) SetSystem(system string) IErrorReport

type ErrDBConnection

type ErrDBConnection struct {
	// contains filtered or unexported fields
}

func NewErrDBConnection

func NewErrDBConnection(err error) *ErrDBConnection

func (ErrDBConnection) Error

func (e ErrDBConnection) Error() string

func (ErrDBConnection) GRPCReport

func (e ErrDBConnection) GRPCReport(errContent *error, prefixMessage string)

func (ErrDBConnection) GetError

func (e ErrDBConnection) GetError() error

func (ErrDBConnection) GetName

func (e ErrDBConnection) GetName() string

GetName method

func (ErrDBConnection) GinReport

func (e ErrDBConnection) GinReport(c *gin.Context)

func (ErrDBConnection) Report

func (e ErrDBConnection) Report(prefix string)

func (*ErrDBConnection) SetSystem

func (e *ErrDBConnection) SetSystem(system string) IErrorReport

type ErrDBDisconnection

type ErrDBDisconnection struct {
	// contains filtered or unexported fields
}

func NewErrDBDisconnection

func NewErrDBDisconnection(err error) *ErrDBDisconnection

func (ErrDBDisconnection) Error

func (e ErrDBDisconnection) Error() string

func (ErrDBDisconnection) GRPCReport

func (e ErrDBDisconnection) GRPCReport(errContent *error, prefixMessage string)

func (ErrDBDisconnection) GetError

func (e ErrDBDisconnection) GetError() error

func (ErrDBDisconnection) GetName

func (e ErrDBDisconnection) GetName() string

GetName method

func (ErrDBDisconnection) GinReport

func (e ErrDBDisconnection) GinReport(c *gin.Context)

func (ErrDBDisconnection) Report

func (e ErrDBDisconnection) Report(prefix string)

func (*ErrDBDisconnection) SetSystem

func (e *ErrDBDisconnection) SetSystem(system string) IErrorReport

type ErrDBExecute

type ErrDBExecute struct {
	// contains filtered or unexported fields
}

func NewErrDBExecute

func NewErrDBExecute(err error) *ErrDBExecute

func (ErrDBExecute) Error

func (e ErrDBExecute) Error() string

func (ErrDBExecute) GRPCReport

func (e ErrDBExecute) GRPCReport(errContent *error, prefixMessage string)

func (ErrDBExecute) GetError

func (e ErrDBExecute) GetError() error

func (ErrDBExecute) GetName

func (e ErrDBExecute) GetName() string

GetName method

func (ErrDBExecute) GinReport

func (e ErrDBExecute) GinReport(c *gin.Context)

func (ErrDBExecute) Report

func (e ErrDBExecute) Report(prefix string)

func (*ErrDBExecute) SetSystem

func (e *ErrDBExecute) SetSystem(system string) IErrorReport

type ErrDBRowNotFound

type ErrDBRowNotFound struct {
	// contains filtered or unexported fields
}

func NewErrDBRowNotFound

func NewErrDBRowNotFound(err error) *ErrDBRowNotFound

func (ErrDBRowNotFound) Error

func (e ErrDBRowNotFound) Error() string

func (ErrDBRowNotFound) GRPCReport

func (e ErrDBRowNotFound) GRPCReport(errContent *error, prefixMessage string)

func (ErrDBRowNotFound) GetError

func (e ErrDBRowNotFound) GetError() error

func (ErrDBRowNotFound) GetName

func (e ErrDBRowNotFound) GetName() string

GetName method

func (ErrDBRowNotFound) GinReport

func (e ErrDBRowNotFound) GinReport(c *gin.Context)

func (ErrDBRowNotFound) Report

func (e ErrDBRowNotFound) Report(prefix string)

func (*ErrDBRowNotFound) SetSystem

func (e *ErrDBRowNotFound) SetSystem(system string) IErrorReport

type ErrDBUpdateNoEffect

type ErrDBUpdateNoEffect struct {
	// contains filtered or unexported fields
}

func NewErrDBUpdateNoEffect

func NewErrDBUpdateNoEffect(err error) *ErrDBUpdateNoEffect

func (ErrDBUpdateNoEffect) Error

func (e ErrDBUpdateNoEffect) Error() string

func (ErrDBUpdateNoEffect) GRPCReport

func (e ErrDBUpdateNoEffect) GRPCReport(errContent *error, prefixMessage string)

func (ErrDBUpdateNoEffect) GetError

func (e ErrDBUpdateNoEffect) GetError() error

func (ErrDBUpdateNoEffect) GetName

func (e ErrDBUpdateNoEffect) GetName() string

GetName method

func (ErrDBUpdateNoEffect) GinReport

func (e ErrDBUpdateNoEffect) GinReport(c *gin.Context)

func (ErrDBUpdateNoEffect) Report

func (e ErrDBUpdateNoEffect) Report(prefix string)

func (*ErrDBUpdateNoEffect) SetSystem

func (e *ErrDBUpdateNoEffect) SetSystem(system string) IErrorReport

type ErrExecute

type ErrExecute struct {
	// contains filtered or unexported fields
}

func NewErrExecute

func NewErrExecute(err error) *ErrExecute

func (ErrExecute) Error

func (e ErrExecute) Error() string

func (ErrExecute) GRPCReport

func (e ErrExecute) GRPCReport(errContent *error, prefixMessage string)

func (ErrExecute) GetError

func (e ErrExecute) GetError() error

func (ErrExecute) GetName

func (e ErrExecute) GetName() string

GetName method

func (ErrExecute) GinReport

func (e ErrExecute) GinReport(c *gin.Context)

func (ErrExecute) Report

func (e ErrExecute) Report(prefix string)

func (*ErrExecute) SetSystem

func (e *ErrExecute) SetSystem(system string) IErrorReport

type ErrGRPCConnection

type ErrGRPCConnection struct {
	// contains filtered or unexported fields
}

func NewErrGRPCConnection

func NewErrGRPCConnection(err error, response interface{}) *ErrGRPCConnection

func (ErrGRPCConnection) Error

func (e ErrGRPCConnection) Error() string

func (ErrGRPCConnection) GRPCReport

func (e ErrGRPCConnection) GRPCReport(errContent *error, prefixMessage string)

func (ErrGRPCConnection) GetError

func (e ErrGRPCConnection) GetError() error

func (ErrGRPCConnection) GetName

func (e ErrGRPCConnection) GetName() string

GetName method

func (ErrGRPCConnection) GinReport

func (e ErrGRPCConnection) GinReport(c *gin.Context)

func (ErrGRPCConnection) Report

func (e ErrGRPCConnection) Report(prefix string)

func (*ErrGRPCConnection) SetSystem

func (e *ErrGRPCConnection) SetSystem(system string) IErrorReport

type ErrGRPCExecute

type ErrGRPCExecute struct {
	// contains filtered or unexported fields
}

func NewErrGRPCExecute

func NewErrGRPCExecute(err error) *ErrGRPCExecute

func (ErrGRPCExecute) Error

func (e ErrGRPCExecute) Error() string

func (ErrGRPCExecute) GRPCReport

func (e ErrGRPCExecute) GRPCReport(errContent *error, prefixMessage string)

func (ErrGRPCExecute) GetError

func (e ErrGRPCExecute) GetError() error

func (ErrGRPCExecute) GetName

func (e ErrGRPCExecute) GetName() string

GetName method

func (ErrGRPCExecute) GinReport

func (e ErrGRPCExecute) GinReport(c *gin.Context)

func (ErrGRPCExecute) Report

func (e ErrGRPCExecute) Report(prefix string)

func (*ErrGRPCExecute) SetSystem

func (e *ErrGRPCExecute) SetSystem(system string) IErrorReport

type ErrInvalidArgument

type ErrInvalidArgument struct {
	// contains filtered or unexported fields
}

func NewErrInvalidArgument

func NewErrInvalidArgument(err error) *ErrInvalidArgument

func (ErrInvalidArgument) Error

func (e ErrInvalidArgument) Error() string

func (ErrInvalidArgument) GRPCReport

func (e ErrInvalidArgument) GRPCReport(errContent *error, prefixMessage string)

func (ErrInvalidArgument) GetError

func (e ErrInvalidArgument) GetError() error

func (ErrInvalidArgument) GetName

func (e ErrInvalidArgument) GetName() string

GetName method

func (ErrInvalidArgument) GinReport

func (e ErrInvalidArgument) GinReport(c *gin.Context)

func (ErrInvalidArgument) Report

func (e ErrInvalidArgument) Report(prefix string)

func (*ErrInvalidArgument) SetSystem

func (e *ErrInvalidArgument) SetSystem(system string) IErrorReport

type ErrJSONMarshal

type ErrJSONMarshal struct {
	// contains filtered or unexported fields
}

func NewErrJSONMarshal

func NewErrJSONMarshal(err error) *ErrJSONMarshal

func (ErrJSONMarshal) Error

func (e ErrJSONMarshal) Error() string

func (ErrJSONMarshal) GRPCReport

func (e ErrJSONMarshal) GRPCReport(errContent *error, prefixMessage string)

func (ErrJSONMarshal) GetError

func (e ErrJSONMarshal) GetError() error

func (ErrJSONMarshal) GetName

func (e ErrJSONMarshal) GetName() string

GetName method

func (ErrJSONMarshal) GinReport

func (e ErrJSONMarshal) GinReport(c *gin.Context)

func (ErrJSONMarshal) Report

func (e ErrJSONMarshal) Report(prefix string)

func (*ErrJSONMarshal) SetSystem

func (e *ErrJSONMarshal) SetSystem(system string) IErrorReport

type ErrJSONUnmarshal

type ErrJSONUnmarshal struct {
	// contains filtered or unexported fields
}

func NewErrJSONUnmarshal

func NewErrJSONUnmarshal(err error) *ErrJSONUnmarshal

func (ErrJSONUnmarshal) Error

func (e ErrJSONUnmarshal) Error() string

func (ErrJSONUnmarshal) GRPCReport

func (e ErrJSONUnmarshal) GRPCReport(errContent *error, prefixMessage string)

func (ErrJSONUnmarshal) GetError

func (e ErrJSONUnmarshal) GetError() error

func (ErrJSONUnmarshal) GetName

func (e ErrJSONUnmarshal) GetName() string

GetName method

func (ErrJSONUnmarshal) GinReport

func (e ErrJSONUnmarshal) GinReport(c *gin.Context)

func (ErrJSONUnmarshal) Report

func (e ErrJSONUnmarshal) Report(prefix string)

func (*ErrJSONUnmarshal) SetSystem

func (e *ErrJSONUnmarshal) SetSystem(system string) IErrorReport

type ErrJWTExecute

type ErrJWTExecute struct {
	// contains filtered or unexported fields
}

func NewErrJWTExecute

func NewErrJWTExecute(err error) *ErrJWTExecute

func (ErrJWTExecute) Error

func (e ErrJWTExecute) Error() string

func (ErrJWTExecute) GRPCReport

func (e ErrJWTExecute) GRPCReport(errContent *error, prefixMessage string)

func (ErrJWTExecute) GetError

func (e ErrJWTExecute) GetError() error

func (ErrJWTExecute) GetName

func (e ErrJWTExecute) GetName() string

GetName method

func (ErrJWTExecute) GinReport

func (e ErrJWTExecute) GinReport(c *gin.Context)

func (ErrJWTExecute) Report

func (e ErrJWTExecute) Report(prefix string)

func (*ErrJWTExecute) SetSystem

func (e *ErrJWTExecute) SetSystem(system string) IErrorReport

type ErrNotFound

type ErrNotFound struct {
	// contains filtered or unexported fields
}

func NewErrNotFound

func NewErrNotFound(err error) *ErrNotFound

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

func (ErrNotFound) GRPCReport

func (e ErrNotFound) GRPCReport(errContent *error, prefixMessage string)

func (ErrNotFound) GetError

func (e ErrNotFound) GetError() error

func (ErrNotFound) GetName

func (e ErrNotFound) GetName() string

GetName method

func (ErrNotFound) GinReport

func (e ErrNotFound) GinReport(c *gin.Context)

func (ErrNotFound) Report

func (e ErrNotFound) Report(prefix string)

func (*ErrNotFound) SetSystem

func (e *ErrNotFound) SetSystem(system string) IErrorReport

type ErrPermissionDeny

type ErrPermissionDeny struct {
	// contains filtered or unexported fields
}

func NewErrPermissionDeny

func NewErrPermissionDeny(err error) *ErrPermissionDeny

func (ErrPermissionDeny) Error

func (e ErrPermissionDeny) Error() string

func (ErrPermissionDeny) GRPCReport

func (e ErrPermissionDeny) GRPCReport(errContent *error, prefixMessage string)

func (ErrPermissionDeny) GetError

func (e ErrPermissionDeny) GetError() error

func (ErrPermissionDeny) GetName

func (e ErrPermissionDeny) GetName() string

GetName method

func (ErrPermissionDeny) GinReport

func (e ErrPermissionDeny) GinReport(c *gin.Context)

func (ErrPermissionDeny) Report

func (e ErrPermissionDeny) Report(prefix string)

func (*ErrPermissionDeny) SetSystem

func (e *ErrPermissionDeny) SetSystem(system string) IErrorReport

type ErrServerExecute

type ErrServerExecute struct {
	// contains filtered or unexported fields
}

func NewErrServerExecute

func NewErrServerExecute(err error) *ErrServerExecute

func (ErrServerExecute) Error

func (e ErrServerExecute) Error() string

func (ErrServerExecute) GRPCReport

func (e ErrServerExecute) GRPCReport(errContent *error, prefixMessage string)

func (ErrServerExecute) GetError

func (e ErrServerExecute) GetError() error

func (ErrServerExecute) GetName

func (e ErrServerExecute) GetName() string

GetName method

func (ErrServerExecute) GinReport

func (e ErrServerExecute) GinReport(c *gin.Context)

func (ErrServerExecute) Report

func (e ErrServerExecute) Report(prefix string)

func (*ErrServerExecute) SetSystem

func (e *ErrServerExecute) SetSystem(system string) IErrorReport

type ErrVariable

type ErrVariable struct {
	// contains filtered or unexported fields
}

func NewErrVariable

func NewErrVariable(err error) *ErrVariable

func (ErrVariable) Error

func (e ErrVariable) Error() string

func (ErrVariable) GRPCReport

func (e ErrVariable) GRPCReport(errContent *error, prefixMessage string)

func (ErrVariable) GetError

func (e ErrVariable) GetError() error

func (ErrVariable) GetName

func (e ErrVariable) GetName() string

GetName method

func (ErrVariable) GinReport

func (e ErrVariable) GinReport(c *gin.Context)

func (ErrVariable) Report

func (e ErrVariable) Report(prefix string)

func (*ErrVariable) SetSystem

func (e *ErrVariable) SetSystem(system string) IErrorReport

type IErrorReport

type IErrorReport interface {
	error
	SetSystem(system string) IErrorReport
	GetName() string
	GetError() error
	Report(prefix string)
}

type IGRPCErrorReport

type IGRPCErrorReport interface {
	IErrorReport
	GRPCReport(errContent *error, prefixMessage string)
}

type IGinErrorReport

type IGinErrorReport interface {
	IErrorReport
	GinReport(c *gin.Context)
}

Jump to

Keyboard shortcuts

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