diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-29 21:51:31 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-29 21:51:31 +0900 |
| commit | 50972096cd8bffd9b17dbdf656ec34c48edb8f86 (patch) | |
| tree | 1ad00bbf65f59539aa9bd0b3e1f42b89b7ca3fcb /container/vfs/unfold.go | |
| parent | 905b9f9785263297611a61facc8b6bdf4c3e257f (diff) | |
container/vfs: wrap decoder errors
This passes line information and handles strconv errors so it reads better.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/vfs/unfold.go')
| -rw-r--r-- | container/vfs/unfold.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/container/vfs/unfold.go b/container/vfs/unfold.go index ca0e37b7..d63f0a9f 100644 --- a/container/vfs/unfold.go +++ b/container/vfs/unfold.go @@ -4,9 +4,14 @@ import ( "iter" "path" "strings" - "syscall" ) +type UnfoldTargetError string + +func (e UnfoldTargetError) Error() string { + return "mount point " + string(e) + " never appeared in mountinfo" +} + // MountInfoNode positions a [MountInfoEntry] in its mount hierarchy. type MountInfoNode struct { *MountInfoEntry @@ -65,7 +70,8 @@ func (d *MountInfoDecoder) Unfold(target string) (*MountInfoNode, error) { } if targetIndex == -1 { - return nil, syscall.ESTALE + // target does not exist in parsed mountinfo + return nil, &DecoderError{Op: "unfold", Line: -1, Err: UnfoldTargetError(targetClean)} } for _, cur := range mountinfo { |
