-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
32 lines (27 loc) · 1.19 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
package deployer
import "fmt"
type Error struct {
Code string
Message string
Err error
}
func (e *Error) Error() string {
if e.Err != nil {
return fmt.Sprintf("%s: %v", e.Message, e.Err)
}
return e.Message
}
func (e *Error) Wrap(err error) error {
e.Err = err
return e
}
var (
ErrUUIDGeneration = &Error{Code: "UUIDGenerationError", Message: "Error generating UUID"}
ErrGettingDispatcherPodConfig = &Error{Code: "GettingDispatcherPodConfigError", Message: "Error getting dispatcher pod config"}
ErrCreateDispatcherPod = &Error{Code: "CreateDispatcherPodError", Message: "Error creating dispatcher pod"}
ErrGetUserHomeDir = &Error{Code: "GetUserHomeDirError", Message: "Error getting user home directory"}
ErrBuildingKubeconfig = &Error{Code: "BuildingKubeconfigError", Message: "Error building kubeconfig"}
ErrGettingContainerLogs = &Error{Code: "GettingContainerLogsError", Message: "Error getting container logs"}
ErrAddFilesToPod = &Error{Code: "AddFilesToPodError", Message: "Error adding files to pod"}
ErrCreateDispatcherRole = &Error{Code: "CreateDispatcherRoleError", Message: "Error creating dispatcher role"}
)