Documentation
¶
Index ¶
- func NewDomainErrorHandler() *errorHandler
- func NewHandlerErrorHandler() *errorHandler
- func NewRepoErrorHandler() *errorHandler
- func NewServiceErrorHandler() *errorHandler
- type Error
- func AlredyExists(msg string) Error
- func BadRequest(msg string) Error
- func Conflict(msg string) Error
- func Forbidden(msg string) Error
- func Generic(msg string) Error
- func Internal(msg string) Error
- func NewError(msg string, status int) Error
- func NotFound(msg string) Error
- func Unauthorized(msg string) Error
- func UnprocessableEntity(msg string) Error
- type ErrorHadler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDomainErrorHandler ¶
func NewDomainErrorHandler() *errorHandler
NewDomainErrorHandler returns an error handler with group of domain
func NewHandlerErrorHandler ¶
func NewHandlerErrorHandler() *errorHandler
NewHandlerErrorHandler returns an error handler with group of handler
func NewRepoErrorHandler ¶
func NewRepoErrorHandler() *errorHandler
NewRepoErrorHandler returns an error handler with group of repo
func NewServiceErrorHandler ¶
func NewServiceErrorHandler() *errorHandler
NewServiceErrorHandler returns an error handler with group of service
Types ¶
type Error ¶
type Error interface {
// Error returns the string representation of the error
Error() string
// Checks if the error has group of server
IsServer() bool
// Checks if the error has group of repository
IsRepository() bool
// Checks if the error has group of service
IsService() bool
// Checks if the error has group of handler
IsHandler() bool
// Checks if the error has group of domain
IsDomain() bool
// Checks if the error has kind of not found
IsNotFound() bool
// Checks if the error has kind of internal
IsInternal() bool
// Checks if the error has kind of bad request
IsBadRequest() bool
// Checks if the error has kind of alredy exists
IsAlredyExists() bool
// Returns the group of the error
GetGroup() string
// Returns the kind of the error
GetKind() string
// Returns the code of the error
GetCode() int
}
Error interface
func AlredyExists ¶ added in v0.1.2
AlredyExistsError returns an alredy exists error
func Unauthorized ¶
UnauthorizedError returns an unauthorized error
func UnprocessableEntity ¶ added in v0.1.2
UnprocessableEntityError returns an unprocessable entity error
type ErrorHadler ¶
type ErrorHadler interface {
// Returns a generic error with the group of the handler
Generic(msg string) Error
// Returns an error with the group of the handler and kind of not found
NotFound(msg string) Error
// Returns an error with the group of the handler and kind of internal
Internal(msg string) Error
// Returns an error with the group of the handler and kind of bad request
BadRequest(msg string) Error
Unauthorized(msg string) Error
// Returns an error with the group of the handler and kind of alredy exists
AlreadyExists(msg string) Error
// Returns an error with the group of the handler and kind of unprocessable entity
UnprocessableEntity(msg string) Error
// Returns an error with the group of the handler and kind of forbidden
Forbidden(msg string) Error
// Returns an error with the group of the handler and kind of conflict
Conflict(msg string) Error
}
ErrorHandler has a pre defined group
Click to show internal directories.
Click to hide internal directories.