Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Status int `json:"status"` Error string `json:"error"` Details string `json:"details,omitempty"` Path string `json:"path,omitempty"` }
Error used to respond to errored http requests.
func DefaultBadRequestError ¶
DefaultBadRequestError function returns a default 400 Bad Request HTTP status code and a custom error. It signifies that the provided request body is not valid.
func DefaultInternalError ¶
DefaultInternalError is a function that logs and returns an internal server error. It accepts an echo.Context, a log.Logger, and an error message in string format. The function generates a unique error code using uuid.NewV4(). The error message and error code are logged using the logger instance. The function then returns an HTTP status code for internal server error (500) and an Error instance with the status set to the HTTP status code, the error message set to "Internal error", and the details containing a message indicating a problem with the request and the generated error code.
func DefaultNotFoundError ¶
DefaultNotFoundError function returns a default 404 Not Found HTTP status code and a custom error. It signifies that the requested resource does not exist, or the user does not have permission to access it.