fix: false success in unmount flow#182
Conversation
a946004 to
891da64
Compare
| @@ -13,6 +13,7 @@ func unmount(dir string) error { | |||
| if strings.HasPrefix(dir, "/dev/fd/") { | |||
| return fmt.Errorf("%w: %s", ErrExternallyManagedMountPoint, err) | |||
There was a problem hiding this comment.
Is it not possible or not desirable to wrap both errors here ? e.g. something like
| return fmt.Errorf("%w: %s", ErrExternallyManagedMountPoint, err) | |
| return fmt.Errorf("%w: %w", ErrExternallyManagedMountPoint, err) |
There was a problem hiding this comment.
I think, not desirable. Also, Unwrap doesn't work in multi %w scenario - https://go.dev/play/p/3aixFmasPAK
There was a problem hiding this comment.
In the sample you attached (thanks for it BTW), I see that the errors.Is returns true for both errors on the combined error, but errors.Wrap return nil on it, which is surprizing a bit.
Error: externally managed mount point: EOF
errors.Is(errWW, ErrExternallyManagedMountPoint): true
errors.Is(errWW, ErrUnderlying): true
errors.Unwrap(errWW): <nil>I am just worried that not wrapping the returned error on the original error would just lose information. There is a way to wrap multiple errors, that can be also be returned using UnWrap e.g. in this sample https://go.dev/play/p/VarDGW6zVe6 , but it's definitely not very easy to use. It returns this:
errors.Is(errWW, ErrExternallyManagedMountPoint): true
errors.Is(errWW, ErrUnderlying): true
Unwrapped error 1: externally managed mount point
Unwrapped error 2: EOF752342c to
e6bd908
Compare
e6bd908 to
365a485
Compare
Unmount flow started returning false success during the unmount after this.