Documentation ¶
Index ¶
- Constants
- Variables
- func ApiErrorMapping(echoError *echo.HTTPError) errors.CodeMsg
- func HttpError(httpStatus int) error
- func HttpErrorBodyValidation(internalErr error) error
- func HttpErrorHandler(err error, c echo.Context)
- func HttpErrorValidation(internalErr error) error
- func HttpErrorValidationWithCode(code errors.CodeMsg, internalErr error) error
- func HttpErrorWithInternal(httpStatus int, code interface{}, internalErr error) error
- func HttpWithServiceError(httpStatus int, code errors.CodeMsg) error
- func ParseFieldError(validationErr validator.FieldError) httpx.InnerError
Constants ¶
View Source
const ( // numbering 100-1000 GeneralCode_UnprocessableEntity = 100 GeneralCode_ResourceNotFound = 101 GeneralCode_MethodNotAllowed = 102 GeneralCode_NotAcceptable = 103 GeneralCode_GatewayTimeout = 104 GeneralCode_Unspecified = 105 GeneralCode_NotHTTPError = 106 GeneralCode_InternalHTTPError = 107 GeneralCode_ValidationFailedError = 108 GeneralCode_BodyBindingFailed = 109 )
View Source
const ( ValidationCode_FieldRequired = 1 ValidationCode_FieldNotEmpty = 2 ValidationCode_FieldTypeISO3166_Alpha2 = 3 ValidationCode_FieldTypeNumeric = 4 ValidationCode_FieldOneOf = 5 ValidationCode_FieldMaxSign = 6 ValidationCode_FieldMaxSigns = 7 ValidationCode_FieldMinSign = 8 ValidationCode_FieldMinSigns = 9 ValidationCode_FieldTypeISO4217 = 10 ValidationCode_FieldMinDecimal = 11 ValidationCode_FieldMinDecimals = 12 ValidationCode_FieldMaxDecimal = 13 ValidationCode_FieldMaxDecimals = 14 // Validator uncompatible errors ValidationCode_FieldUnknownTagError = 9998 ValidationCode_FieldUnknownError = 9999 )
Field validation error codes Field validation error descriptors
View Source
const ( ParamsTagOneOf = ":validOptions" ParamsTagMin = ":min" ParamsTagMax = ":max" )
Field validation param tagsf
Variables ¶
View Source
var ( ApiErrorUnprocessableEntity = errors.New(http.StatusUnprocessableEntity, GeneralCode_UnprocessableEntity, "Unprocessable Entity") ApiErrorResourceNotFound = errors.New(http.StatusNotFound, GeneralCode_ResourceNotFound, "Resource not found") ApiErrorMethodNotAllowed = errors.New(http.StatusMethodNotAllowed, GeneralCode_MethodNotAllowed, "Method Not Allowed") ApiErrorNotAcceptable = errors.New(http.StatusNotAcceptable, GeneralCode_NotAcceptable, "Not Acceptable") ApiErrorGatewayTimeout = errors.New(http.StatusGatewayTimeout, GeneralCode_NotHTTPError, "Gateway Timeout") ApiErrorUnspecified = errors.New(http.StatusNotAcceptable, GeneralCode_Unspecified, "Unspecified") ApiErrorNotHTTPError = errors.New(http.StatusNotFound, GeneralCode_NotHTTPError, "Not Http Error") ApiErrorInternalServerError = errors.New(http.StatusInternalServerError, GeneralCode_InternalHTTPError, "Internal Server Error") ApiErrorValidationBodyFailed = errors.New(http.StatusBadRequest, GeneralCode_ValidationFailedError, "Validation Failed") ApiErrorBodyBindingFailed = errors.New(http.StatusUnprocessableEntity, GeneralCode_BodyBindingFailed, "Body Binding Failed") )
Functions ¶
func ApiErrorMapping ¶
func HttpErrorBodyValidation ¶
func HttpErrorHandler ¶
func HttpErrorHandler(err error, c echo.Context)
func HttpErrorValidation ¶
HttpErrorValidation Validation errror with internal error
func HttpErrorValidationWithCode ¶
HttpErrorValidationWithCode Validation error with internal error
func HttpErrorWithInternal ¶
HttpErrorWithInternal echo.HttpError has a message interface{} field, which can be used to include the ServiceCode
func HttpWithServiceError ¶
HttpWithServiceError Make an echo compatible error out of a service error
func ParseFieldError ¶
func ParseFieldError(validationErr validator.FieldError) httpx.InnerError
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.