Skip to content

Commit 620ae8a

Browse files
committed
fix
1 parent 94df6c0 commit 620ae8a

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

pkg/fileservice/error.go

+19-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package fileservice
1616

1717
import (
1818
"errors"
19-
"fmt"
2019
"io"
2120
"net"
2221
"regexp"
@@ -110,8 +109,24 @@ func isDiskFull(err error) bool {
110109
return strings.Contains(str, "disk quota exceeded")
111110
}
112111

113-
var errorF = fmt.Errorf
112+
type errorWrap struct {
113+
what string
114+
err error
115+
}
116+
117+
var _ error = errorWrap{}
118+
119+
func (e errorWrap) Error() string {
120+
return e.what + ": " + e.err.Error()
121+
}
114122

115-
func wrapError(what string, err error) error {
116-
return errorF(what+": %w", err)
123+
func (e errorWrap) Unwrap() error {
124+
return e.err
125+
}
126+
127+
func wrapError(what string, err error) errorWrap {
128+
return errorWrap{
129+
what: what,
130+
err: err,
131+
}
117132
}

0 commit comments

Comments
 (0)