Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSiteMissing = Error{ErrorCode: "SITE_MISSING", ErrorDescription: "missing site"} ErrUnknown = Error{ErrorCode: "UNKNOWN_ERROR", ErrorDescription: "error is unknown"} ErrTimeout = Error{ErrorCode: "TIMEOUT", ErrorDescription: "request timeout"} ErrInternalServerError = Error{ErrorCode: "INTERNAL_SERVER_ERROR", ErrorDescription: "internal server error"} )
Functions ¶
func CustomErrorHandler ¶ added in v2.3.22
func CustomErrorHandler(errorHandler ErrorHandler) func(error, echo.Context)
Types ¶
type Error ¶
type Error struct {
ErrorCode string `json:"errorCode"`
ErrorDescription string `json:"errorDescription"`
Field *string `json:"field,omitempty"`
Info *map[string]interface{} `json:"info,omitempty"`
}
func (Error) ToErrorResponse ¶
func (e Error) ToErrorResponse() ErrorResponse
func (Error) WithDescription ¶ added in v2.3.21
type ErrorHandler ¶ added in v2.3.18
type ErrorHandler struct {
UnknownError func(msg string) error
TimeoutError func(msg string) error
HttpStatusFrom func(ctx context.Context, err error) int
ToApiError func(err error) error
}
func (*ErrorHandler) HandleError ¶ added in v2.3.18
type ErrorResponse ¶
type ErrorResponse struct {
MainError Error `json:"mainError"`
AllErrors []Error `json:"allErrors"`
}
func NewErrorResponse ¶
func NewErrorResponse(errorCode string, errorDescription string, field string, info map[string]interface{}) ErrorResponse
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
Click to show internal directories.
Click to hide internal directories.