/
error.go
47 lines (39 loc) · 955 Bytes
/
error.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package file
// AbortError should be returned whenever a file operation is terminated
// before it has completed.
type AbortError struct {
err error
}
// NewAbortError creates a new AbortError instance.
func NewAbortError(err error) error {
return &AbortError{
err: err,
}
}
// Unwrap returns an underlying error.
func (e *AbortError) Unwrap() error {
return e.err
}
// Error implements standard go error interface.
func (e *AbortError) Error() string {
return e.err.Error()
}
// HashError should be returned whenever a file operation is terminated
// before it has completed.
type HashError struct {
err error
}
// NewHashError creates a new HashError instance.
func NewHashError(err error) error {
return &HashError{
err: err,
}
}
// Unwrap returns an underlying error.
func (e *HashError) Unwrap() error {
return e.err
}
// Error implements standard go error interface.
func (e *HashError) Error() string {
return e.err.Error()
}