-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
55 lines (41 loc) · 1 KB
/
errors.go
File metadata and controls
55 lines (41 loc) · 1 KB
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
48
49
50
51
52
53
54
55
package bittorrent
import (
"errors"
"fmt"
"honnef.co/go/bittorrent/protocol"
)
var ErrClosing = errors.New("client is shutting down")
type Error struct {
Error error
Peer *Peer
}
type UnknownTorrentError struct {
hash protocol.InfoHash
}
func (err UnknownTorrentError) Error() string {
return fmt.Sprintf("unknown torrent %s", err.hash)
}
type StoppedTorrentError struct {
hash protocol.InfoHash
}
func (err StoppedTorrentError) Error() string {
return fmt.Sprintf("stopped torrent %s", err.hash)
}
type WriteError struct {
error
}
func (err WriteError) Unwrap() error {
return err.error
}
type CallbackRejectedInfoHashError struct {
Hash protocol.InfoHash
}
func (err CallbackRejectedInfoHashError) Error() string {
return fmt.Sprintf("peer wasn't allowed to connect to torrent %s", err.Hash)
}
type CallbackRejectedPeerIDError struct {
PeerID [20]byte
}
func (err CallbackRejectedPeerIDError) Error() string {
return fmt.Sprintf("peer wasn't allowed to connect with peer ID %q", err.PeerID)
}