Documentation ¶
Index ¶
- func Decode(r io.Reader, v interface{}) error
- func Error(w http.ResponseWriter, r *http.Request, status int, err error)
- func ExtractUUID(r *http.Request, name string) (uuid.UUID, error)
- func Friendly(err error, format string, v ...interface{}) error
- func JSON(w http.ResponseWriter, r *http.Request, status int, v interface{})
- func NoContent(w http.ResponseWriter, r *http.Request)
- func ParseUUID(raw, desc string) (uuid.UUID, error)
- type FriendlyError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error writes a JSON error response to w with the error message in an "error" field:
api.Error(w, r, 404, errors.New("entity not found")) // {"error": "entity not found"}
Types ¶
type FriendlyError ¶
FriendlyError is an error with a human-friendly message.
func (FriendlyError) Error ¶
func (err FriendlyError) Error() string
func (FriendlyError) FriendlyError ¶
func (err FriendlyError) FriendlyError() string
func (FriendlyError) Unwrap ¶
func (err FriendlyError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.