Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandlerMiddleware ¶
func ErrorHandlerMiddleware() gin.HandlerFunc
ErrorHandlerMiddleware :
Types ¶
type Error ¶
type Error struct {
Error *ErrorResponse `json:"error,omitempty"`
}
Error represents the error object
type ErrorObject ¶
type ErrorObject struct { Domain string `json:"domain,omitempty"` Reason string `json:"reason,omitempty"` Message string `json:"message,omitempty"` ExtendedHelp string `json:"extendedHelp,omitempty"` SendReport string `json:"sendReport,omitempty"` }
ErrorObject gives extensive info to the error and other errors involved
var InternalError ErrorObject = ErrorObject{
Reason: "InternalServerError",
Message: "whoops something went wrong",
}
InternalError a response for any internal error within the system
var ValidationError ErrorObject = ErrorObject{
Reason: "FieldValidationError",
Message: "Your request is in a bad format",
}
ValidationError a response for validation errors
type ErrorResponse ¶
type ErrorResponse struct { StatusCode int `json:"statusCode"` Message string `json:"message"` Errors []ErrorObject `json:"errors,omitempty"` }
ErrorResponse represents the response of the error
Click to show internal directories.
Click to hide internal directories.