-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.go
More file actions
75 lines (64 loc) · 1.95 KB
/
Copy patherrors.go
File metadata and controls
75 lines (64 loc) · 1.95 KB
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
package flagsmithapi
import (
"fmt"
"strings"
)
type FeatureNotFoundError struct {
featureUUID string
}
type FeatureStateNotFoundError struct {
featureStateUUID string
}
type SegmentNotFoundError struct {
segmentUUID string
}
type FeatureMVOptionNotFoundError struct {
featureMVOptionUUID string
}
type UserNotFoundError struct {
email string
}
type MetadataFieldNotFoundError struct {
Name string
Entity string
KnownNames []string
}
type MetadataFieldNotBoundError struct {
Name string
Entity string
}
type MetadataFieldInvalidValueError struct {
Name string
FieldType string
Value string
Reason string
}
func (e MetadataFieldNotFoundError) Error() string {
if len(e.KnownNames) == 0 {
return fmt.Sprintf("flagsmithapi: no custom fields are enabled for %ss in this project", e.Entity)
}
return fmt.Sprintf("flagsmithapi: no custom field named '%s' is available for %ss in this project (available: %s)",
e.Name, e.Entity, strings.Join(e.KnownNames, ", "))
}
func (e MetadataFieldNotBoundError) Error() string {
return fmt.Sprintf("flagsmithapi: the custom field '%s' exists but is not enabled for %ss",
e.Name, e.Entity)
}
func (e MetadataFieldInvalidValueError) Error() string {
return fmt.Sprintf("flagsmithapi: invalid value for custom field '%s': %s", e.Name, e.Reason)
}
func (e FeatureNotFoundError) Error() string {
return fmt.Sprintf("flagsmithapi: feature '%s' not found", e.featureUUID)
}
func (e SegmentNotFoundError) Error() string {
return fmt.Sprintf("flagsmithapi: segment '%s' not found", e.segmentUUID)
}
func (e FeatureStateNotFoundError) Error() string {
return fmt.Sprintf("flagsmithapi: feature state '%s' not found", e.featureStateUUID)
}
func (e FeatureMVOptionNotFoundError) Error() string {
return fmt.Sprintf("flagsmithapi: feature mv option '%s' not found", e.featureMVOptionUUID)
}
func (e UserNotFoundError) Error() string {
return fmt.Sprintf("flagsmithapi: user with email '%s' not found", e.email)
}