add more descriptive errors

Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
Tw
2016-10-11 10:15:33 +08:00
parent e5d33e73f3
commit d0455c7b9c
6 changed files with 87 additions and 11 deletions
+3 -1
View File
@@ -21,6 +21,8 @@ import (
"strings"
"sync"
"time"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
var bufferPool = sync.Pool{New: createBuffer}
@@ -189,7 +191,7 @@ func (rp *ReverseProxy) ServeHTTP(rw http.ResponseWriter, outreq *http.Request,
res.Body.Close()
hj, ok := rw.(http.Hijacker)
if !ok {
panic("not a hijacker")
panic(httpserver.NonHijackerError{Underlying: rw})
}
conn, _, err := hj.Hijack()