-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
116 lines (93 loc) · 2.54 KB
/
errors.go
File metadata and controls
116 lines (93 loc) · 2.54 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package managers
import (
"errors"
"fmt"
"path/filepath"
"strings"
)
var (
ErrNoCommand = errors.New("no command provided")
ErrUnsupportedOperation = errors.New("operation not supported by this manager")
ErrUnsupportedOption = errors.New("option not supported by this manager")
)
type ErrNoManifest struct {
Dir string
}
func (e ErrNoManifest) Error() string {
return fmt.Sprintf("no package manifest found in %s", e.Dir)
}
type ErrCLINotFound struct {
Manager string
Binary string
Files []string
}
func (e ErrCLINotFound) Error() string {
return fmt.Sprintf("%s not found (detected from %s). Install %s or add it to PATH",
e.Binary, strings.Join(e.Files, ", "), e.Manager)
}
type ErrUnsupportedVersion struct {
Manager string
Version string
Nearest string
}
func (e ErrUnsupportedVersion) Error() string {
if e.Nearest != "" {
return fmt.Sprintf("%s %s not supported (nearest: %s)", e.Manager, e.Version, e.Nearest)
}
return fmt.Sprintf("%s %s not supported", e.Manager, e.Version)
}
type ErrConflictingLockfiles struct {
Dir string
Lockfiles []string
}
func (e ErrConflictingLockfiles) Error() string {
return fmt.Sprintf("multiple lockfiles in %s: %s. Remove all but one or specify manager explicitly",
e.Dir, strings.Join(e.Lockfiles, ", "))
}
type ErrManifestNotInRoot struct {
Dir string
Found string
Expected string
}
func (e ErrManifestNotInRoot) Error() string {
return fmt.Sprintf("found %s but not in project root (found in %s)",
filepath.Base(e.Found), filepath.Dir(e.Found))
}
type ErrOrphanedWorkspaceMember struct {
Dir string
MemberFile string
}
func (e ErrOrphanedWorkspaceMember) Error() string {
return fmt.Sprintf("appears to be a workspace member but no workspace root found above %s", e.Dir)
}
type ErrInvalidPackageName struct {
Name string
Reason string
}
func (e ErrInvalidPackageName) Error() string {
return fmt.Sprintf("invalid package name %q: %s", e.Name, e.Reason)
}
type ErrMissingArgument struct {
Argument string
}
func (e ErrMissingArgument) Error() string {
return fmt.Sprintf("missing required argument: %s", e.Argument)
}
type ErrPolicyViolation struct {
Policy string
Reason string
Command []string
}
func (e ErrPolicyViolation) Error() string {
return fmt.Sprintf("policy %q denied operation: %s", e.Policy, e.Reason)
}
type ErrPolicyCheck struct {
Policy string
Err error
}
func (e ErrPolicyCheck) Error() string {
return fmt.Sprintf("policy %q check failed: %v", e.Policy, e.Err)
}
func (e ErrPolicyCheck) Unwrap() error {
return e.Err
}