forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
83 lines (64 loc) · 2.05 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
package shared
import "time"
type JobFailedError struct {
JobGUID string
Message string
}
func (e JobFailedError) Error() string {
return "Job ({{.JobGUID}}) failed: {{.Message}}"
}
func (e JobFailedError) Translate(translate func(string, ...interface{}) string) string {
return translate(e.Error(), map[string]interface{}{
"Message": e.Message,
"JobGUID": e.JobGUID,
})
}
type JobTimeoutError struct {
JobGUID string
Timeout time.Duration
}
func (e JobTimeoutError) Error() string {
return "Job ({{.JobGUID}}) polling timeout has been reached. The operation may still be running on the CF instance. Your CF operator may have more information."
}
func (e JobTimeoutError) Translate(translate func(string, ...interface{}) string) string {
return translate(e.Error(), map[string]interface{}{
"JobGUID": e.JobGUID,
})
}
type NoOrganizationTargetedError struct{}
func (e NoOrganizationTargetedError) Error() string {
return "An org must be targeted before targeting a space"
}
func (e NoOrganizationTargetedError) Translate(translate func(string, ...interface{}) string) string {
return translate(e.Error())
}
type OrganizationNotFoundError struct {
Name string
}
func (e OrganizationNotFoundError) Error() string {
return "Organization '{{.Name}}' not found."
}
func (e OrganizationNotFoundError) Translate(translate func(string, ...interface{}) string) string {
return translate(e.Error(), map[string]interface{}{
"Name": e.Name,
})
}
type SpaceNotFoundError struct {
Name string
}
func (e SpaceNotFoundError) Error() string {
return "Space '{{.Name}}' not found."
}
func (e SpaceNotFoundError) Translate(translate func(string, ...interface{}) string) string {
return translate(e.Error(), map[string]interface{}{
"Name": e.Name,
})
}
type HTTPHealthCheckInvalidError struct {
}
func (e HTTPHealthCheckInvalidError) Error() string {
return "Health check type must be 'http' to set a health check HTTP endpoint."
}
func (e HTTPHealthCheckInvalidError) Translate(translate func(string, ...interface{}) string) string {
return translate(e.Error())
}