コード例 #1
0
ファイル: daemon.go プロジェクト: Neverous/other-docker
// This file contains all of the errors that can be generated from the
// docker/daemon component.

import (
	"net/http"

	"github.com/docker/distribution/registry/api/errcode"
)

var (
	// ErrorCodeNoSuchContainer is generated when we look for a container by
	// name or ID and we can't find it.
	ErrorCodeNoSuchContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "NOSUCHCONTAINER",
		Message:        "No such container: %s",
		Description:    "The specified container can not be found",
		HTTPStatusCode: http.StatusNotFound,
	})

	// ErrorCodeUnregisteredContainer is generated when we try to load
	// a storage driver for an unregistered container
	ErrorCodeUnregisteredContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "UNREGISTEREDCONTAINER",
		Message:        "Can't load storage driver for unregistered container %s",
		Description:    "An attempt was made to load the storage driver for a container that is not registered with the daemon",
		HTTPStatusCode: http.StatusInternalServerError,
	})

	// ErrorCodeContainerBeingRemoved is generated when an attempt to start
	// a container is made but its in the process of being removed, or is dead.
	ErrorCodeContainerBeingRemoved = errcode.Register(errGroup, errcode.ErrorDescriptor{
コード例 #2
0
ファイル: register.go プロジェクト: cpuguy83/drax
package errors

import "github.com/docker/distribution/registry/api/errcode"

var (
	// StoreKeyNotFound is an error returned by the API when the requested key is not found in the store
	StoreKeyNotFound = errcode.Register("store", errcode.ErrorDescriptor{
		Value:       "KEYNOTFOUND",
		Message:     "Key not found in store",
		Description: "Key does not exist in the K/V store",
	})

	// StoreKeyModified is an error returned by the API when the key was modified during an atomic operation
	StoreKeyModified = errcode.Register("store", errcode.ErrorDescriptor{
		Value:       "KEYMODIFIED",
		Message:     "Unable to complete atomic operation, key modified",
		Description: "Key was modified while operation was being performed",
	})
)
コード例 #3
0
ファイル: errors.go プロジェクト: CadeLaRen/docker-3
import (
	"net/http"

	"github.com/docker/distribution/registry/api/errcode"
)

const errGroup = "registry.api.v2"

var (
	// ErrorCodeDigestInvalid is returned when uploading a blob if the
	// provided digest does not match the blob contents.
	ErrorCodeDigestInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:   "DIGEST_INVALID",
		Message: "provided digest did not match uploaded content",
		Description: `When a blob is uploaded, the registry will check that
		the content matches the digest provided by the client. The error may
		include a detail structure with the key "digest", including the
		invalid digest string. This error may also be returned when a manifest
		includes an invalid layer digest.`,
		HTTPStatusCode: http.StatusBadRequest,
	})

	// ErrorCodeSizeInvalid is returned when uploading a blob if the provided
	ErrorCodeSizeInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:   "SIZE_INVALID",
		Message: "provided length did not match content length",
		Description: `When a layer is uploaded, the provided size will be
		checked against the uploaded content. If they do not match, this error
		will be returned.`,
		HTTPStatusCode: http.StatusBadRequest,
	})
コード例 #4
0
ファイル: server.go プロジェクト: pirater/os
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",
コード例 #5
0
ファイル: daemon.go プロジェクト: francisbouvier/docker
package errors

// This file contains all of the errors that can be generated from the
// docker/daemon component.

import (
	"net/http"

	"github.com/docker/distribution/registry/api/errcode"
)

var (
	// ErrorCodeNoSuchContainer is generated when we look for a container by
	// name or ID and we can't find it.
	ErrorCodeNoSuchContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "NOSUCHCONTAINER",
		Message:        "no such id: %s",
		Description:    "The specified container can not be found",
		HTTPStatusCode: http.StatusNotFound,
	})
)
コード例 #6
0
// This file contains all of the errors that can be generated from the
// docker/daemon component.

import (
	"net/http"

	"github.com/docker/distribution/registry/api/errcode"
)

var (
	// ErrorCodeNoSuchContainer is generated when we look for a container by
	// name or ID and we can't find it.
	ErrorCodeNoSuchContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "NOSUCHCONTAINER",
		Message:        "no such id: %s",
		Description:    "The specified container can not be found",
		HTTPStatusCode: http.StatusNotFound,
	})

	// ErrorCodeUnregisteredContainer is generated when we try to load
	// a storage driver for an unregistered container
	ErrorCodeUnregisteredContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "UNREGISTEREDCONTAINER",
		Message:        "Can't load storage driver for unregistered container %s",
		HTTPStatusCode: http.StatusInternalServerError,
	})

	// ErrorCodeContainerBeingRemoved is generated when an attempt to start
	// a container is made but its in the process of being removed, or is dead.
	ErrorCodeContainerBeingRemoved = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "CONTAINERBEINGREMOVED",
コード例 #7
0
ファイル: errors.go プロジェクト: useidel/notary
	"net/http"

	"github.com/docker/distribution/registry/api/errcode"
)

// The notary API is on version 1, but URLs start with /v2/ to be consistent
// with the registry API
const errGroup = "notary.api.v1"

// These errors should be returned from contextHandlers only. They are
// serialized and returned to a user as part of the generic error handling
// done by the rootHandler
var (
	ErrNoStorage = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "NO_STORAGE",
		Message:        "The server is misconfigured and has no storage.",
		Description:    "No storage backend has been configured for the server.",
		HTTPStatusCode: http.StatusInternalServerError,
	})
	ErrNoFilename = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "NO_FILENAME",
		Message:        "No file/role name provided.",
		Description:    "No file/role name is provided to associate an update with.",
		HTTPStatusCode: http.StatusBadRequest,
	})
	ErrInvalidRole = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "INVALID_ROLE",
		Message:        "The role you are attempting to operate on is invalid.",
		Description:    "The user attempted to operate on a role that is not deemed valid.",
		HTTPStatusCode: http.StatusBadRequest,
	})
	ErrMalformedJSON = errcode.Register(errGroup, errcode.ErrorDescriptor{
コード例 #8
0
ファイル: server.go プロジェクト: newdeamon/docker
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,
	})
)
コード例 #9
0
ファイル: image.go プロジェクト: DaveDaCoda/docker
package errors

// This file contains all of the errors that can be generated from the
// docker/image component.

import (
	"net/http"

	"github.com/docker/distribution/registry/api/errcode"
)

var (
	// ErrorCodeInvalidImageID is generated when image id specified is incorrectly formatted.
	ErrorCodeInvalidImageID = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "INVALIDIMAGEID",
		Message:        "image ID '%s' is invalid ",
		Description:    "The specified image id is incorrectly formatted",
		HTTPStatusCode: http.StatusInternalServerError,
	})
)
コード例 #10
0
ファイル: errors.go プロジェクト: CowLeo/distribution
package main

import (
	"net/http"

	"github.com/docker/distribution/registry/api/errcode"
)

var (
	errGroup = "tokenserver"

	// ErrorBadTokenOption is returned when a token parameter is invalid
	ErrorBadTokenOption = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:   "BAD_TOKEN_OPTION",
		Message: "bad token option",
		Description: `This error may be returned when a request for a
		token contains an option which is not valid`,
		HTTPStatusCode: http.StatusBadRequest,
	})

	// ErrorMissingRequiredField is returned when a required form field is missing
	ErrorMissingRequiredField = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:   "MISSING_REQUIRED_FIELD",
		Message: "missing required field",
		Description: `This error may be returned when a request for a
		token does not contain a required form field`,
		HTTPStatusCode: http.StatusBadRequest,
	})

	// ErrorUnsupportedValue is returned when a form field has an unsupported value
	ErrorUnsupportedValue = errcode.Register(errGroup, errcode.ErrorDescriptor{
コード例 #11
0
ファイル: builder.go プロジェクト: DaveDaCoda/docker
// This file contains all of the errors that can be generated from the
// docker/builder component.

import (
	"net/http"

	"github.com/docker/distribution/registry/api/errcode"
)

var (
	// ErrorCodeAtLeastOneArg is generated when the parser comes across a
	// Dockerfile command that doesn't have any args.
	ErrorCodeAtLeastOneArg = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "ATLEASTONEARG",
		Message:        "%s requires at least one argument",
		Description:    "The specified command requires at least one argument",
		HTTPStatusCode: http.StatusInternalServerError,
	})

	// ErrorCodeExactlyOneArg is generated when the parser comes across a
	// Dockerfile command that requires exactly one arg but got less/more.
	ErrorCodeExactlyOneArg = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "EXACTLYONEARG",
		Message:        "%s requires exactly one argument",
		Description:    "The specified command requires exactly one argument",
		HTTPStatusCode: http.StatusInternalServerError,
	})

	// ErrorCodeAtLeastTwoArgs is generated when the parser comes across a
	// Dockerfile command that requires at least two args but got less.
	ErrorCodeAtLeastTwoArgs = errcode.Register(errGroup, errcode.ErrorDescriptor{
コード例 #12
0
ファイル: network.go プロジェクト: leobcn/docker
package errors

// This file contains all of the errors that can be generated from the
// docker/network component.

import (
	"net/http"

	"github.com/docker/distribution/registry/api/errcode"
)

var (
	// ErrorCodeNetworkAlreadyExists is generated when trying to create a
	// network with a name that's already registered.
	ErrorCodeNetworkAlreadyExists = errcode.Register(errGroup, errcode.ErrorDescriptor{
		Value:          "NETWORKALREADYEXISTS",
		Message:        "network with name %s already exists",
		Description:    "The specified network name already exists",
		HTTPStatusCode: http.StatusConflict,
	})
)