aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/moby/sys/mount/mount_errors.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/moby/sys/mount/mount_errors.go')
-rw-r--r--vendor/github.com/moby/sys/mount/mount_errors.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/github.com/moby/sys/mount/mount_errors.go b/vendor/github.com/moby/sys/mount/mount_errors.go
new file mode 100644
index 000000000..936a26373
--- /dev/null
+++ b/vendor/github.com/moby/sys/mount/mount_errors.go
@@ -0,0 +1,46 @@
+// +build !windows
+
+package mount
+
+import "strconv"
+
+// mountError records an error from mount or unmount operation
+type mountError struct {
+ op string
+ source, target string
+ flags uintptr
+ data string
+ err error
+}
+
+func (e *mountError) Error() string {
+ out := e.op + " "
+
+ if e.source != "" {
+ out += e.source + ":" + e.target
+ } else {
+ out += e.target
+ }
+
+ if e.flags != uintptr(0) {
+ out += ", flags: 0x" + strconv.FormatUint(uint64(e.flags), 16)
+ }
+ if e.data != "" {
+ out += ", data: " + e.data
+ }
+
+ out += ": " + e.err.Error()
+ return out
+}
+
+// Cause returns the underlying cause of the error.
+// This is a convention used in github.com/pkg/errors
+func (e *mountError) Cause() error {
+ return e.err
+}
+
+// Unwrap returns the underlying error.
+// This is a convention used in golang 1.13+
+func (e *mountError) Unwrap() error {
+ return e.err
+}