1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/errors/server.go
David Calavera eb982e7c00 Return 404 for all network operations without network controller.
This will prevent the api from trying to serve network requests in
systems where libnetwork is not enabled, returning 404 responses in any
case.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-10-19 14:40:18 -04:00

36 lines
1.5 KiB
Go

package errors
import (
"net/http"
"github.com/docker/distribution/registry/api/errcode"
)
var (
// ErrorCodeNewerClientVersion is generated when a request from a client
// specifies a higher version than the server supports.
ErrorCodeNewerClientVersion = errcode.Register(errGroup, errcode.ErrorDescriptor{
Value: "NEWERCLIENTVERSION",
Message: "client is newer than server (client API version: %s, server API version: %s)",
Description: "The client version is higher than the server version",
HTTPStatusCode: http.StatusBadRequest,
})
// ErrorCodeOldClientVersion is generated when a request from a client
// specifies a version lower than the minimum version supported by the server.
ErrorCodeOldClientVersion = errcode.Register(errGroup, errcode.ErrorDescriptor{
Value: "OLDCLIENTVERSION",
Message: "client version %s is too old. Minimum supported API version is %s, please upgrade your client to a newer version",
Description: "The client version is too old for the server",
HTTPStatusCode: http.StatusBadRequest,
})
// ErrorNetworkControllerNotEnabled is generated when the networking stack in not enabled
// for certain platforms, like windows.
ErrorNetworkControllerNotEnabled = errcode.Register(errGroup, errcode.ErrorDescriptor{
Value: "NETWORK_CONTROLLER_NOT_ENABLED",
Message: "the network controller is not enabled for this platform",
Description: "Docker's networking stack is disabled for this platform",
HTTPStatusCode: http.StatusNotFound,
})
)