Browse code

Move errors/ to api/errors

Using:
gomvpkg -from github.com/docker/docker/errors
-to github.com/docker/docker/api/errors
-vcs_mv_cmd "git mv {{.Src}} {{.Dst}}"

Signed-off-by: Daniel Nephin <dnephin@docker.com>

Daniel Nephin authored on 2016/09/16 02:15:57
Showing 18 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,47 @@
0
+package errors
1
+
2
+import "net/http"
3
+
4
+// apiError is an error wrapper that also
5
+// holds information about response status codes.
6
+type apiError struct {
7
+	error
8
+	statusCode int
9
+}
10
+
11
+// HTTPErrorStatusCode returns a status code.
12
+func (e apiError) HTTPErrorStatusCode() int {
13
+	return e.statusCode
14
+}
15
+
16
+// NewErrorWithStatusCode allows you to associate
17
+// a specific HTTP Status Code to an error.
18
+// The Server will take that code and set
19
+// it as the response status.
20
+func NewErrorWithStatusCode(err error, code int) error {
21
+	return apiError{err, code}
22
+}
23
+
24
+// NewBadRequestError creates a new API error
25
+// that has the 400 HTTP status code associated to it.
26
+func NewBadRequestError(err error) error {
27
+	return NewErrorWithStatusCode(err, http.StatusBadRequest)
28
+}
29
+
30
+// NewRequestForbiddenError creates a new API error
31
+// that has the 403 HTTP status code associated to it.
32
+func NewRequestForbiddenError(err error) error {
33
+	return NewErrorWithStatusCode(err, http.StatusForbidden)
34
+}
35
+
36
+// NewRequestNotFoundError creates a new API error
37
+// that has the 404 HTTP status code associated to it.
38
+func NewRequestNotFoundError(err error) error {
39
+	return NewErrorWithStatusCode(err, http.StatusNotFound)
40
+}
41
+
42
+// NewRequestConflictError creates a new API error
43
+// that has the 409 HTTP status code associated to it.
44
+func NewRequestConflictError(err error) error {
45
+	return NewErrorWithStatusCode(err, http.StatusConflict)
46
+}
... ...
@@ -8,13 +8,13 @@ import (
8 8
 
9 9
 	"github.com/Sirupsen/logrus"
10 10
 	"github.com/docker/docker/api"
11
+	"github.com/docker/docker/api/errors"
11 12
 	"github.com/docker/docker/api/server/httputils"
12 13
 	"github.com/docker/docker/api/types"
13 14
 	"github.com/docker/docker/api/types/events"
14 15
 	"github.com/docker/docker/api/types/filters"
15 16
 	timetypes "github.com/docker/docker/api/types/time"
16 17
 	"github.com/docker/docker/api/types/versions"
17
-	"github.com/docker/docker/errors"
18 18
 	"github.com/docker/docker/pkg/ioutils"
19 19
 	"golang.org/x/net/context"
20 20
 )
... ...
@@ -8,10 +8,10 @@ import (
8 8
 	"strings"
9 9
 
10 10
 	"github.com/Sirupsen/logrus"
11
+	"github.com/docker/docker/api/errors"
11 12
 	"github.com/docker/docker/api/server/httputils"
12 13
 	"github.com/docker/docker/api/server/middleware"
13 14
 	"github.com/docker/docker/api/server/router"
14
-	"github.com/docker/docker/errors"
15 15
 	"github.com/gorilla/mux"
16 16
 	"golang.org/x/net/context"
17 17
 )
... ...
@@ -6,10 +6,10 @@ import (
6 6
 	"time"
7 7
 
8 8
 	"github.com/Sirupsen/logrus"
9
+	"github.com/docker/docker/api/errors"
9 10
 	"github.com/docker/docker/api/types/backend"
10 11
 	"github.com/docker/docker/container"
11 12
 	"github.com/docker/docker/daemon/logger"
12
-	"github.com/docker/docker/errors"
13 13
 	"github.com/docker/docker/pkg/stdcopy"
14 14
 	"github.com/docker/docker/pkg/term"
15 15
 )
... ...
@@ -14,6 +14,7 @@ import (
14 14
 	"google.golang.org/grpc"
15 15
 
16 16
 	"github.com/Sirupsen/logrus"
17
+	"github.com/docker/docker/api/errors"
17 18
 	apitypes "github.com/docker/docker/api/types"
18 19
 	"github.com/docker/docker/api/types/filters"
19 20
 	"github.com/docker/docker/api/types/network"
... ...
@@ -21,7 +22,6 @@ import (
21 21
 	"github.com/docker/docker/daemon/cluster/convert"
22 22
 	executorpkg "github.com/docker/docker/daemon/cluster/executor"
23 23
 	"github.com/docker/docker/daemon/cluster/executor/container"
24
-	"github.com/docker/docker/errors"
25 24
 	"github.com/docker/docker/opts"
26 25
 	"github.com/docker/docker/pkg/ioutils"
27 26
 	"github.com/docker/docker/pkg/signal"
... ...
@@ -6,11 +6,11 @@ import (
6 6
 	"regexp"
7 7
 	"time"
8 8
 
9
+	"github.com/docker/docker/api/errors"
9 10
 	containertypes "github.com/docker/docker/api/types/container"
10 11
 	"github.com/docker/docker/api/types/strslice"
11 12
 	"github.com/docker/docker/container"
12 13
 	"github.com/docker/docker/daemon/network"
13
-	"github.com/docker/docker/errors"
14 14
 	"github.com/docker/docker/image"
15 15
 	"github.com/docker/docker/pkg/signal"
16 16
 	"github.com/docker/docker/pkg/system"
... ...
@@ -9,11 +9,11 @@ import (
9 9
 	"strings"
10 10
 
11 11
 	"github.com/Sirupsen/logrus"
12
+	derr "github.com/docker/docker/api/errors"
12 13
 	containertypes "github.com/docker/docker/api/types/container"
13 14
 	networktypes "github.com/docker/docker/api/types/network"
14 15
 	"github.com/docker/docker/container"
15 16
 	"github.com/docker/docker/daemon/network"
16
-	derr "github.com/docker/docker/errors"
17 17
 	"github.com/docker/docker/pkg/stringid"
18 18
 	"github.com/docker/docker/runconfig"
19 19
 	"github.com/docker/go-connections/nat"
... ...
@@ -6,11 +6,11 @@ import (
6 6
 	"strings"
7 7
 
8 8
 	"github.com/Sirupsen/logrus"
9
+	"github.com/docker/docker/api/errors"
9 10
 	"github.com/docker/docker/api/types"
10 11
 	containertypes "github.com/docker/docker/api/types/container"
11 12
 	networktypes "github.com/docker/docker/api/types/network"
12 13
 	"github.com/docker/docker/container"
13
-	"github.com/docker/docker/errors"
14 14
 	"github.com/docker/docker/image"
15 15
 	"github.com/docker/docker/layer"
16 16
 	"github.com/docker/docker/pkg/idtools"
... ...
@@ -7,9 +7,9 @@ import (
7 7
 	"strings"
8 8
 
9 9
 	"github.com/Sirupsen/logrus"
10
+	"github.com/docker/docker/api/errors"
10 11
 	"github.com/docker/docker/api/types"
11 12
 	"github.com/docker/docker/container"
12
-	"github.com/docker/docker/errors"
13 13
 	"github.com/docker/docker/layer"
14 14
 	volumestore "github.com/docker/docker/volume/store"
15 15
 )
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	"fmt"
5 5
 	"strings"
6 6
 
7
-	"github.com/docker/docker/errors"
7
+	"github.com/docker/docker/api/errors"
8 8
 	"github.com/docker/docker/reference"
9 9
 )
10 10
 
... ...
@@ -9,11 +9,11 @@ import (
9 9
 	"golang.org/x/net/context"
10 10
 
11 11
 	"github.com/Sirupsen/logrus"
12
+	"github.com/docker/docker/api/errors"
12 13
 	"github.com/docker/docker/api/types"
13 14
 	"github.com/docker/docker/api/types/strslice"
14 15
 	"github.com/docker/docker/container"
15 16
 	"github.com/docker/docker/daemon/exec"
16
-	"github.com/docker/docker/errors"
17 17
 	"github.com/docker/docker/libcontainerd"
18 18
 	"github.com/docker/docker/pkg/pools"
19 19
 	"github.com/docker/docker/pkg/signal"
... ...
@@ -4,9 +4,9 @@ import (
4 4
 	"fmt"
5 5
 	"strings"
6 6
 
7
+	"github.com/docker/docker/api/errors"
7 8
 	"github.com/docker/docker/api/types"
8 9
 	"github.com/docker/docker/container"
9
-	"github.com/docker/docker/errors"
10 10
 	"github.com/docker/docker/image"
11 11
 	"github.com/docker/docker/pkg/stringid"
12 12
 	"github.com/docker/docker/reference"
... ...
@@ -7,10 +7,10 @@ import (
7 7
 	"strings"
8 8
 
9 9
 	"github.com/Sirupsen/logrus"
10
+	"github.com/docker/docker/api/errors"
10 11
 	"github.com/docker/docker/api/types"
11 12
 	"github.com/docker/docker/api/types/network"
12 13
 	clustertypes "github.com/docker/docker/daemon/cluster/provider"
13
-	"github.com/docker/docker/errors"
14 14
 	"github.com/docker/docker/runconfig"
15 15
 	"github.com/docker/libnetwork"
16 16
 	networktypes "github.com/docker/libnetwork/types"
... ...
@@ -10,10 +10,10 @@ import (
10 10
 	"google.golang.org/grpc"
11 11
 
12 12
 	"github.com/Sirupsen/logrus"
13
+	"github.com/docker/docker/api/errors"
13 14
 	"github.com/docker/docker/api/types"
14 15
 	containertypes "github.com/docker/docker/api/types/container"
15 16
 	"github.com/docker/docker/container"
16
-	"github.com/docker/docker/errors"
17 17
 	"github.com/docker/docker/libcontainerd"
18 18
 	"github.com/docker/docker/runconfig"
19 19
 )
... ...
@@ -6,8 +6,8 @@ import (
6 6
 	"time"
7 7
 
8 8
 	"github.com/Sirupsen/logrus"
9
+	"github.com/docker/docker/api/errors"
9 10
 	"github.com/docker/docker/container"
10
-	"github.com/docker/docker/errors"
11 11
 )
12 12
 
13 13
 // ContainerStop looks for the given container and terminates it,
... ...
@@ -7,11 +7,11 @@ import (
7 7
 	"path/filepath"
8 8
 	"strings"
9 9
 
10
+	dockererrors "github.com/docker/docker/api/errors"
10 11
 	"github.com/docker/docker/api/types"
11 12
 	containertypes "github.com/docker/docker/api/types/container"
12 13
 	mounttypes "github.com/docker/docker/api/types/mount"
13 14
 	"github.com/docker/docker/container"
14
-	dockererrors "github.com/docker/docker/errors"
15 15
 	"github.com/docker/docker/volume"
16 16
 	"github.com/opencontainers/runc/libcontainer/label"
17 17
 )
18 18
deleted file mode 100644
... ...
@@ -1,47 +0,0 @@
1
-package errors
2
-
3
-import "net/http"
4
-
5
-// apiError is an error wrapper that also
6
-// holds information about response status codes.
7
-type apiError struct {
8
-	error
9
-	statusCode int
10
-}
11
-
12
-// HTTPErrorStatusCode returns a status code.
13
-func (e apiError) HTTPErrorStatusCode() int {
14
-	return e.statusCode
15
-}
16
-
17
-// NewErrorWithStatusCode allows you to associate
18
-// a specific HTTP Status Code to an error.
19
-// The Server will take that code and set
20
-// it as the response status.
21
-func NewErrorWithStatusCode(err error, code int) error {
22
-	return apiError{err, code}
23
-}
24
-
25
-// NewBadRequestError creates a new API error
26
-// that has the 400 HTTP status code associated to it.
27
-func NewBadRequestError(err error) error {
28
-	return NewErrorWithStatusCode(err, http.StatusBadRequest)
29
-}
30
-
31
-// NewRequestForbiddenError creates a new API error
32
-// that has the 403 HTTP status code associated to it.
33
-func NewRequestForbiddenError(err error) error {
34
-	return NewErrorWithStatusCode(err, http.StatusForbidden)
35
-}
36
-
37
-// NewRequestNotFoundError creates a new API error
38
-// that has the 404 HTTP status code associated to it.
39
-func NewRequestNotFoundError(err error) error {
40
-	return NewErrorWithStatusCode(err, http.StatusNotFound)
41
-}
42
-
43
-// NewRequestConflictError creates a new API error
44
-// that has the 409 HTTP status code associated to it.
45
-func NewRequestConflictError(err error) error {
46
-	return NewErrorWithStatusCode(err, http.StatusConflict)
47
-}
... ...
@@ -3,7 +3,7 @@ package runconfig
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"github.com/docker/docker/errors"
6
+	"github.com/docker/docker/api/errors"
7 7
 )
8 8
 
9 9
 var (