Documentation
¶
Overview ¶
Package jsonerr provides a simple way to return structured error information to the client using JSON encoding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(w http.ResponseWriter, err error, code int)
Error writes structured error information to w using JSON encoding. The given status code is used if it is non-zero, otherwise it is set to 500.
If err is nil it writes sets the status to 200 OK and writes:
{"code": "ok", "message": ""}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.