Documentation ¶
Index ¶
- Variables
- type Config
- type ErrInvalidRequestContent
- type ErrorResponse
- func ErrorForbidden(errorText string) *ErrorResponse
- func ErrorInternalServer(err error) *ErrorResponse
- func ErrorInvalidRequest(err error) *ErrorResponse
- func ErrorNotFound(errorText string) *ErrorResponse
- func ErrorRemoteServerUnavailable(err error) *ErrorResponse
- func ErrorRender(err error) *ErrorResponse
Constants ¶
This section is empty.
Variables ¶
var ErrMethodNotAllowed = &ErrorResponse{HTTPStatusCode: 405, StatusText: "Method not allowed."}
ErrMethodNotAllowed is default 405 router method not allowed
var ErrNotFound = &ErrorResponse{HTTPStatusCode: 404, StatusText: "Page not found."}
ErrNotFound is default router page not found
Functions ¶
This section is empty.
Types ¶
type ErrInvalidRequestContent ¶
type ErrInvalidRequestContent struct {
ValidationError error
}
ErrInvalidRequestContent used as custom error for dto logical validations
func (ErrInvalidRequestContent) Error ¶
func (err ErrInvalidRequestContent) Error() string
Error is a representation of Error interface method
type ErrorResponse ¶
type ErrorResponse struct { Err error `json:"-"` // low-level runtime error HTTPStatusCode int `json:"-"` // http response status code StatusText string `json:"status"` // user-level status message ErrorText string `json:"error,omitempty"` // application-level error message, for debugging }
ErrorResponse represents custom error response with statusText and error description
func ErrorForbidden ¶
func ErrorForbidden(errorText string) *ErrorResponse
ErrorForbidden return 403 with given error text
func ErrorInternalServer ¶
func ErrorInternalServer(err error) *ErrorResponse
ErrorInternalServer returns error response with status=500 and given error
func ErrorInvalidRequest ¶
func ErrorInvalidRequest(err error) *ErrorResponse
ErrorInvalidRequest return error response with status = 400 and given error
func ErrorNotFound ¶
func ErrorNotFound(errorText string) *ErrorResponse
ErrorNotFound return 404 with given error text
func ErrorRemoteServerUnavailable ¶
func ErrorRemoteServerUnavailable(err error) *ErrorResponse
ErrorRemoteServerUnavailable return 503 when remote trigger check failed
func ErrorRender ¶
func ErrorRender(err error) *ErrorResponse
ErrorRender return 422 render error and used for response rendering errors
func (*ErrorResponse) Render ¶
func (e *ErrorResponse) Render(w http.ResponseWriter, r *http.Request) error
Render realization method for render.renderer
Directories ¶
Path | Synopsis |
---|---|
nolint nolint nolint nolint nolint nolint nolint nolint nolint
|
nolint nolint nolint nolint nolint nolint nolint nolint nolint |