Debian Codegraph @

mount/mount_errors.go

raw symbols SCIP
1 //go:build !darwin && !windows
2
3 package mount
4
5 import "strconv"
6
7 // mountError records an error from mount or unmount operation
8 type mountError struct {
9 op string
10 source, target string
11 flags uintptr
12 data string
13 err error
14 }
15
16 func (e *mountError) Error() string {
17 out := e.op + " "
18
19 if e.source != "" {
20 out += e.source + ":" + e.target
21 } else {
22 out += e.target
23 }
24
25 if e.flags != uintptr(0) {
26 out += ", flags: 0x" + strconv.FormatUint(uint64(e.flags), 16)
27 }
28 if e.data != "" {
29 out += ", data: " + e.data
30 }
31
32 out += ": " + e.err.Error()
33 return out
34 }
35
36 // Cause returns the underlying cause of the error.
37 // This is a convention used in github.com/pkg/errors
38 func (e *mountError) Cause() error {
39 return e.err
40 }
41
42 // Unwrap returns the underlying error.
43 // This is a convention used in golang 1.13+
44 func (e *mountError) Unwrap() error {
45 return e.err
46 }