-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patherrors.go
92 lines (71 loc) · 3.01 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package containers
import (
"errors"
"fmt"
)
var errorBasicFormat = "%s with: %w"
// Image Method Errors
var (
ErrorImageOptions = errors.New("image options failed")
ErrorImageBuild = errors.New("building image failed")
ErrorImagePull = errors.New("pulling image failed")
ErrorClientPull = errors.New("client pull failed")
ErrorImageBuildDockerFile = errors.New("building Dockerfile failed")
ErrorImageBuildResCopy = errors.New("copying response from image build failed")
ErrorImagePullStatus = errors.New("copying pull status failed")
ErrorContainerOptions = errors.New("container options failed")
ErrorContainerCreate = errors.New("creating container failed")
errorImageFormat = "%s for image `%s` with: %w"
)
func errorImageOptions(image string, err error) error {
return fmt.Errorf(errorImageFormat, ErrorImageOptions, image, err)
}
func errorImageBuild(image string, err error) error {
return fmt.Errorf(errorImageFormat, ErrorImageBuild, image, err)
}
func errorImagePull(image string, err error) error {
return fmt.Errorf(errorImageFormat, ErrorImagePull, image, err)
}
func errorClientPull(err error) error {
return fmt.Errorf(errorBasicFormat, ErrorClientPull, err)
}
func errorImageBuildDockerFile(err error) error {
return fmt.Errorf(errorBasicFormat, ErrorImageBuildDockerFile, err)
}
func errorImageBuildResCopy(err error) error {
return fmt.Errorf(errorBasicFormat, ErrorImageBuildResCopy, err)
}
func errorImagePullStatus(err error) error {
return fmt.Errorf(errorBasicFormat, ErrorImagePullStatus, err)
}
func errorContainerOptions(image string, err error) error {
return fmt.Errorf(errorImageFormat, ErrorContainerOptions, image, err)
}
func errorContainerCreate(image string, err error) error {
return fmt.Errorf(errorImageFormat, ErrorContainerCreate, image, err)
}
// Container Method Errors
var (
ErrorContainerStart = errors.New("start container failed")
ErrorContainerWait = errors.New("container wait failed")
ErrorClientWait = errors.New("client wait failed")
ErrorContainerInspect = errors.New("inspecting container failed")
ErrorExitCode = errors.New("exit-code")
ErrorContainerLogs = errors.New("getting container logs failed")
errorContainerFormat = "%s for container Id:`%s` image:`%s` with: %w"
)
func errorContainerStart(id, image string, err error) error {
return fmt.Errorf(errorContainerFormat, ErrorContainerStart, id, image, err)
}
func errorContainerWait(id, image string, err error) error {
return fmt.Errorf(errorContainerFormat, ErrorContainerWait, id, image, err)
}
func errorContainerInspect(id, image string, err error) error {
return fmt.Errorf(errorContainerFormat, ErrorContainerInspect, id, image, err)
}
func errorContainerExitCode(id, image string, code int) error {
return fmt.Errorf("container Id:`%s` image:`%s` failed with %w:%d", id, image, ErrorExitCode, code)
}
func errorContainerLogs(id, image string, err error) error {
return fmt.Errorf(errorContainerFormat, ErrorContainerLogs, id, image, err)
}