diff --git a/api.go b/api.go index d6f507f..52d4577 100644 --- a/api.go +++ b/api.go @@ -71,12 +71,12 @@ func NotFound(message string, args ...interface{}) Error { if message == "" { message = "Not found" } - return New(http.StatusNotFound, fmt.Sprintf(message, args...)) + return New(http.StatusNotFound, message, args...) } // NotImplemented creates a new not implemented error func NotImplemented(message string) Error { - return New(http.StatusNotImplemented, message) + return New(http.StatusNotImplemented, "%s", message) } // MethodNotAllowedError represents an error for when the path matches but the method doesn't @@ -179,7 +179,7 @@ func ServeError(rw http.ResponseWriter, r *http.Request, err error) { default: rw.WriteHeader(http.StatusInternalServerError) if r == nil || r.Method != http.MethodHead { - _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, err.Error()))) + _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, "%v", err))) } } } diff --git a/go.mod b/go.mod index f5da7cb..0f26e32 100644 --- a/go.mod +++ b/go.mod @@ -11,4 +11,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -go 1.20 +go 1.24.0