mirror of
https://github.com/astaxie/beego.git
synced 2024-12-22 16:00:50 +00:00
fix: add error code support
This commit is contained in:
parent
946a42c021
commit
03f78b2e4a
15
error.go
15
error.go
@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
errorTypeHandler = iota
|
||||
errorTypeHandler = iota
|
||||
errorTypeController
|
||||
)
|
||||
|
||||
@ -359,6 +359,19 @@ func gatewayTimeout(rw http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
}
|
||||
|
||||
// show 413 Payload Too Large
|
||||
func payloadTooLarge(rw http.ResponseWriter, r *http.Request) {
|
||||
responseError(rw, r,
|
||||
413,
|
||||
"<br>The page you have requested is unavailable."+
|
||||
"<br>Perhaps you are here because:"+
|
||||
"<br><br><ul>"+
|
||||
"<br>The request entity is larger than limits defined by server"+
|
||||
"<br>Please change the request entity and try again."+
|
||||
"</ul>",
|
||||
)
|
||||
}
|
||||
|
||||
func responseError(rw http.ResponseWriter, r *http.Request, errCode int, errContent string) {
|
||||
t, _ := template.New("beegoerrortemp").Parse(errtpl)
|
||||
data := M{
|
||||
|
Loading…
Reference in New Issue
Block a user