Documentation ¶
Index ¶
- Variables
- func Errorhandler(err string, h http.HandlerFunc)
- func Exception(errcode string, w http.ResponseWriter, r *http.Request, msg string)
- func Forbidden(rw http.ResponseWriter, r *http.Request)
- func InternalServerError(rw http.ResponseWriter, r *http.Request)
- func NotFound(rw http.ResponseWriter, r *http.Request)
- func RegisterErrorHandler()
- func ServiceUnavailable(rw http.ResponseWriter, r *http.Request)
- func ShowErr(err interface{}, rw http.ResponseWriter, r *http.Request, Stack string)
- func SimpleServerError(rw http.ResponseWriter, r *http.Request)
- func Unauthorized(rw http.ResponseWriter, r *http.Request)
- type HTTPException
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AppName string VERSION string )
View Source
var ErrorMaps map[string]http.HandlerFunc
map of http handlers for each error string.
View Source
var HTTPExceptionMaps map[int]HTTPException
map of http exceptions for each http status code int. defined 400,401,403,404,405,500,502,503 and 504 default.
Functions ¶
func Errorhandler ¶
func Errorhandler(err string, h http.HandlerFunc)
add http handler for given error string.
func Exception ¶
show error string as simple text message. if error string is empty, show 500 error as default.
func InternalServerError ¶
func InternalServerError(rw http.ResponseWriter, r *http.Request)
show 500 internal server error.
func RegisterErrorHandler ¶
func RegisterErrorHandler()
register default error http handlers, 404,401,403,500 and 503.
func ServiceUnavailable ¶
func ServiceUnavailable(rw http.ResponseWriter, r *http.Request)
show 503 service unavailable error.
func ShowErr ¶
func ShowErr(err interface{}, rw http.ResponseWriter, r *http.Request, Stack string)
render default application error page with error and stack string.
func SimpleServerError ¶
func SimpleServerError(rw http.ResponseWriter, r *http.Request)
show 500 internal error with simple text string.
func Unauthorized ¶
func Unauthorized(rw http.ResponseWriter, r *http.Request)
show 401 unauthorized error.
Types ¶
type HTTPException ¶
http exceptions
func (*HTTPException) Error ¶
func (e *HTTPException) Error() string
return http exception error string, e.g. "400 Bad Request".
Click to show internal directories.
Click to hide internal directories.