diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-23 17:47:50 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-23 17:51:05 +0200 |
commit | 9e210f61a6259c37cc7938cf353527cf072b3eda (patch) | |
tree | 5f2855377262b2e915ebf801502c835d6bcec75b /pkg/ext | |
parent | ba84c0d82066739adbca468846a2688e02432b6f (diff) | |
download | cerrado-9e210f61a6259c37cc7938cf353527cf072b3eda.tar.gz cerrado-9e210f61a6259c37cc7938cf353527cf072b3eda.tar.bz2 cerrado-9e210f61a6259c37cc7938cf353527cf072b3eda.zip |
ref: User correct err naming
Diffstat (limited to 'pkg/ext')
-rw-r--r-- | pkg/ext/compression.go | 6 | ||||
-rw-r--r-- | pkg/ext/router.go | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/pkg/ext/compression.go b/pkg/ext/compression.go index 9e933ef..6c7a219 100644 --- a/pkg/ext/compression.go +++ b/pkg/ext/compression.go @@ -16,7 +16,7 @@ import ( ) var ( - invalidParamErr = errors.New("Invalid weighted param") + errInvalidParam = errors.New("Invalid weighted param") ) type CompressionResponseWriter struct { @@ -135,7 +135,7 @@ func GetLZWWriter(w io.Writer) io.WriteCloser { func getWeighedValue(part string) (float64, error) { ps := strings.SplitN(part, "=", 2) if len(ps) != 2 { - return 0, invalidParamErr + return 0, errInvalidParam } if name := strings.TrimSpace(ps[0]); name == "q" { w, err := strconv.ParseFloat(ps[1], 64) @@ -145,5 +145,5 @@ func getWeighedValue(part string) (float64, error) { return w, nil } - return 0, invalidParamErr + return 0, errInvalidParam } diff --git a/pkg/ext/router.go b/pkg/ext/router.go index 5d22814..96da1c9 100644 --- a/pkg/ext/router.go +++ b/pkg/ext/router.go @@ -34,7 +34,7 @@ func (r *Router) AddMiddleware(middleware Middleware) { func wrapError(next ErrorRequestHandler) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if err := next(w, r); err != nil { - if errors.Is(err, service.RepositoryNotFoundErr) { + if errors.Is(err, service.ErrRepositoryNotFound) { NotFound(w) } else { InternalServerError(w, err) |