-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
68 lines (62 loc) · 2.34 KB
/
Copy patherrors.go
File metadata and controls
68 lines (62 loc) · 2.34 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
package execenv
import (
"errors"
"fmt"
)
var (
// ErrInvalid indicates a grant id, image, or network value cannot be used.
ErrInvalid = errors.New("execenv: invalid")
// ErrUnknownImage indicates the host does not have the requested image.
ErrUnknownImage = errors.New("execenv: unknown image")
// ErrCapacity indicates the host has no remaining grant slots.
ErrCapacity = errors.New("execenv: no capacity")
// ErrConflict indicates a live grant was ensured with a different image or network.
ErrConflict = errors.New("execenv: grant conflict")
// ErrUnavailable indicates the host cannot occupy grants.
ErrUnavailable = errors.New("execenv: host unavailable")
// ErrFrozen indicates the grant is frozen.
ErrFrozen = errors.New("execenv: grant frozen")
// ErrRevoked indicates the grant no longer exists.
ErrRevoked = errors.New("execenv: grant revoked")
// ErrBusy indicates a terminal is already attached.
ErrBusy = errors.New("execenv: terminal busy")
// ErrClosed indicates the terminal or observation has been closed.
ErrClosed = errors.New("execenv: closed")
// ErrNotFound indicates a path does not exist in the projection.
ErrNotFound = errors.New("execenv: not found")
// ErrLagged indicates Watch dropped events and the caller must resync.
ErrLagged = errors.New("execenv: observation lagged")
// ErrTooLarge indicates a file or tree exceeds the documented limits.
ErrTooLarge = errors.New("execenv: too large")
// ErrConnection indicates the remote session was lost. A dropped PTY is
// hangup (ErrClosed), not this error, and does not revoke the grant.
ErrConnection = errors.New("execenv: connection failed")
// ErrNetwork indicates the grant requested a network the host does not
// offer. The caller cannot supply destinations; only the host allowlist
// exists, and it may be empty.
ErrNetwork = errors.New("execenv: network not offered")
)
// OpError adds operation context while preserving errors.Is matching.
type OpError struct {
Op string
Err error
}
func (e *OpError) Error() string {
if e == nil {
return "<nil>"
}
return fmt.Sprintf("execenv %s: %v", e.Op, e.Err)
}
func (e *OpError) Unwrap() error {
if e == nil {
return nil
}
return e.Err
}
// Error annotates err with an operation. A nil error remains nil.
func Error(op string, err error) error {
if err == nil {
return nil
}
return &OpError{Op: op, Err: err}
}