middleware_error_handler.go 315 B

1234567891011121314
  1. package middleware
  2. import (
  3. "github.com/gogf/gf/net/ghttp"
  4. "net/http"
  5. )
  6. func ErrorHandler(r *ghttp.Request) {
  7. r.Middleware.Next()
  8. if r.Response.Status >= http.StatusInternalServerError {
  9. r.Response.ClearBuffer()
  10. r.Response.Writeln("哎哟我去,服务器居然开小差了,请稍后再试吧!")
  11. }
  12. }