Merge pull request #44679 from thaJeztah/23.0_backport_errdefs_improve_debug_logs

[23.0 backport] errdefs: FromStatusCode() don't log "FIXME" debug message
This commit is contained in:
Tianon Gravi 2022-12-21 09:38:50 -08:00 committed by GitHub
commit cba986b340
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,14 +2,12 @@ package errdefs // import "github.com/docker/docker/errdefs"
import (
"net/http"
"github.com/sirupsen/logrus"
)
// FromStatusCode creates an errdef error, based on the provided HTTP status-code
func FromStatusCode(err error, statusCode int) error {
if err == nil {
return err
return nil
}
switch statusCode {
case http.StatusNotFound:
@ -33,11 +31,6 @@ func FromStatusCode(err error, statusCode int) error {
err = System(err)
}
default:
logrus.WithError(err).WithFields(logrus.Fields{
"module": "api",
"status_code": statusCode,
}).Debug("FIXME: Got an status-code for which error does not match any expected type!!!")
switch {
case statusCode >= 200 && statusCode < 400:
// it's a client error