From 73f473fc51f81ec9f859f1399bef064c59879283 Mon Sep 17 00:00:00 2001 From: Christoph Polcin Date: Fri, 24 Oct 2014 11:25:17 +0200 Subject: [PATCH] add utils.newPathError --- utils.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils.go b/utils.go index c992869..8ab3cf6 100644 --- a/utils.go +++ b/utils.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "net/http" + "os" "strconv" "strings" "time" @@ -16,6 +17,10 @@ func Error(r *http.Response) error { return errors.New(fmt.Sprintf("%s - %s %s", r.Status, r.Request.Method, r.Request.URL.String())) } +func newPathError(op string, path string, statusCode int) error { + return &os.PathError{op, path, errors.New(fmt.Sprintf("%d", statusCode))} +} + func FixSlash(s string) string { if !strings.HasSuffix(s, "/") { s += "/"