diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-30 22:49:12 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-30 22:49:12 +0900 |
| commit | f5abce9df5727904a1daa246025a87c4bfe62553 (patch) | |
| tree | 7e8c29b83e97532954dee8adb5f86962eaebca34 /system/link.go | |
| parent | ddb003e39b64c2417cabc291383d99b4ad64ac8f (diff) | |
system: wrap op errors
This passes more information allowing for better error handling. This eliminates generic WrapErr from system.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/link.go')
| -rw-r--r-- | system/link.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/system/link.go b/system/link.go index f307e672..022ee4ea 100644 --- a/system/link.go +++ b/system/link.go @@ -27,15 +27,13 @@ func (l *Hardlink) Type() Enablement { return l.et } func (l *Hardlink) apply(*I) error { msg.Verbose("linking", l) - return wrapErrSuffix(os.Link(l.src, l.dst), - fmt.Sprintf("cannot link %q:", l.dst)) + return newOpError("hardlink", os.Link(l.src, l.dst), false) } func (l *Hardlink) revert(_ *I, ec *Criteria) error { if ec.hasType(l) { msg.Verbosef("removing hard link %q", l.dst) - return wrapErrSuffix(os.Remove(l.dst), - fmt.Sprintf("cannot remove hard link %q:", l.dst)) + return newOpError("hardlink", os.Remove(l.dst), true) } else { msg.Verbosef("skipping hard link %q", l.dst) return nil |
