Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderJSON ¶
func RenderJSON(w http.ResponseWriter, r *http.Request, err *Error)
RenderJSON marshals `goerr.Error` to `JSON`, automatically excaping HTML and sets the 'Content-Type' as `application/json`.
func SetHTTPStatus ¶
func SetHTTPStatus(code int)
SetHTTPStatus sets a HTTP response status code if it's not set before.
Types ¶
type Error ¶
type Error struct {
Message string `json:"message,omitempty"`
Details []error `json:"details,omitempty"`
Trace trace `json:"trace,omitempty"`
}
Error is a simple error struct with a HTTP response status code. SEE: https://www.restapitutorial.com/httpstatuscodes.html
Click to show internal directories.
Click to hide internal directories.