add utils.newPathError

This commit is contained in:
Christoph Polcin 2014-10-24 11:25:17 +02:00
parent c23fd5a8be
commit 73f473fc51

View File

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"os"
"strconv" "strconv"
"strings" "strings"
"time" "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())) 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 { func FixSlash(s string) string {
if !strings.HasSuffix(s, "/") { if !strings.HasSuffix(s, "/") {
s += "/" s += "/"