|
@@ -2,14 +2,12 @@ package errdefs // import "github.com/docker/docker/errdefs"
|
|
|
|
|
|
import (
|
|
import (
|
|
"net/http"
|
|
"net/http"
|
|
-
|
|
|
|
- "github.com/sirupsen/logrus"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
// FromStatusCode creates an errdef error, based on the provided HTTP status-code
|
|
// FromStatusCode creates an errdef error, based on the provided HTTP status-code
|
|
func FromStatusCode(err error, statusCode int) error {
|
|
func FromStatusCode(err error, statusCode int) error {
|
|
if err == nil {
|
|
if err == nil {
|
|
- return err
|
|
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
switch statusCode {
|
|
switch statusCode {
|
|
case http.StatusNotFound:
|
|
case http.StatusNotFound:
|
|
@@ -33,11 +31,6 @@ func FromStatusCode(err error, statusCode int) error {
|
|
err = System(err)
|
|
err = System(err)
|
|
}
|
|
}
|
|
default:
|
|
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 {
|
|
switch {
|
|
case statusCode >= 200 && statusCode < 400:
|
|
case statusCode >= 200 && statusCode < 400:
|
|
// it's a client error
|
|
// it's a client error
|