Restore SimpleServerError method
Showing
1 changed file
with
9 additions
and
5 deletions
| ... | @@ -13,8 +13,8 @@ var ( | ... | @@ -13,8 +13,8 @@ var ( |
| 13 | VERSION string | 13 | VERSION string |
| 14 | ) | 14 | ) |
| 15 | var tpl = ` | 15 | var tpl = ` |
| 16 | <!DOCTYPE html> | 16 | <!DOCTYPE html> |
| 17 | <html> | 17 | <html> |
| 18 | <head> | 18 | <head> |
| 19 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | 19 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 20 | <title>beego application error</title> | 20 | <title>beego application error</title> |
| ... | @@ -28,10 +28,10 @@ var tpl = ` | ... | @@ -28,10 +28,10 @@ var tpl = ` |
| 28 | #content .stack pre{padding-left: 10px;} | 28 | #content .stack pre{padding-left: 10px;} |
| 29 | table {} | 29 | table {} |
| 30 | td.t {text-align: right; padding-right: 5px; color: #888;} | 30 | td.t {text-align: right; padding-right: 5px; color: #888;} |
| 31 | </style> | 31 | </style> |
| 32 | <script type="text/javascript"> | 32 | <script type="text/javascript"> |
| 33 | </script> | 33 | </script> |
| 34 | </head> | 34 | </head> |
| 35 | <body> | 35 | <body> |
| 36 | <div id="header"> | 36 | <div id="header"> |
| 37 | <h2>{{.AppError}}</h2> | 37 | <h2>{{.AppError}}</h2> |
| ... | @@ -58,7 +58,7 @@ var tpl = ` | ... | @@ -58,7 +58,7 @@ var tpl = ` |
| 58 | <p>golang version: {{.GoVersion}}</p> | 58 | <p>golang version: {{.GoVersion}}</p> |
| 59 | </div> | 59 | </div> |
| 60 | </body> | 60 | </body> |
| 61 | </html> | 61 | </html> |
| 62 | ` | 62 | ` |
| 63 | 63 | ||
| 64 | func ShowErr(err interface{}, rw http.ResponseWriter, r *http.Request, Stack string) { | 64 | func ShowErr(err interface{}, rw http.ResponseWriter, r *http.Request, Stack string) { |
| ... | @@ -262,6 +262,10 @@ func InternalServerError(rw http.ResponseWriter, r *http.Request) { | ... | @@ -262,6 +262,10 @@ func InternalServerError(rw http.ResponseWriter, r *http.Request) { |
| 262 | t.Execute(rw, data) | 262 | t.Execute(rw, data) |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | func SimpleServerError(rw http.ResponseWriter, r *http.Request) { | ||
| 266 | http.Error(rw, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) | ||
| 267 | } | ||
| 268 | |||
| 265 | func Errorhandler(err string, h http.HandlerFunc) { | 269 | func Errorhandler(err string, h http.HandlerFunc) { |
| 266 | ErrorMaps[err] = h | 270 | ErrorMaps[err] = h |
| 267 | } | 271 | } | ... | ... |
-
Please register or sign in to post a comment