-
-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy patherrors.go
More file actions
29 lines (22 loc) · 736 Bytes
/
errors.go
File metadata and controls
29 lines (22 loc) · 736 Bytes
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
package workspace
import "fmt"
// ErrNotInWorkspace signals that the target directory is outside the configured workspace.
type ErrNotInWorkspace string
// ErrNotExist signals that the target directory could not be located.
type ErrNotExist string
func (err ErrNotInWorkspace) Error() string {
return fmt.Sprintf("%s not within workspace", string(err))
}
func (err ErrNotExist) Error() string {
return fmt.Sprintf("%s not found", string(err))
}
// IsNotInWorkspace checks if this is an ErrNotInWorkspace error.
func IsNotInWorkspace(err error) bool {
_, ok := err.(ErrNotInWorkspace)
return ok
}
// IsNotExist checks if this is an ErrNotExist error.
func IsNotExist(err error) bool {
_, ok := err.(ErrNotExist)
return ok
}