-
Notifications
You must be signed in to change notification settings - Fork 43
/
errors.go
46 lines (35 loc) · 1.11 KB
/
errors.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
package desync
import "fmt"
// ChunkMissing is returned by a store that can't find a requested chunk
type ChunkMissing struct {
ID ChunkID
}
// NoSuchObject is returned by a store that can't find a requested object
type NoSuchObject struct {
location string
}
func (e ChunkMissing) Error() string {
return fmt.Sprintf("chunk %s missing from store", e.ID)
}
func (e NoSuchObject) Error() string {
return fmt.Sprintf("object %s missing from store", e.location)
}
// ChunkInvalid means the hash of the chunk content doesn't match its ID
type ChunkInvalid struct {
ID ChunkID
Sum ChunkID
}
func (e ChunkInvalid) Error() string {
return fmt.Sprintf("chunk id %s does not match its hash %s", e.ID, e.Sum)
}
// InvalidFormat is returned when an error occurred when parsing an archive file
type InvalidFormat struct {
Msg string
}
func (e InvalidFormat) Error() string {
return fmt.Sprintf("invalid archive format : %s", e.Msg)
}
// Interrupted is returned when a user interrupted a long-running operation, for
// example by pressing Ctrl+C
type Interrupted struct{}
func (e Interrupted) Error() string { return "interrupted" }