-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
32 lines (26 loc) · 690 Bytes
/
errors.go
File metadata and controls
32 lines (26 loc) · 690 Bytes
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
package wrapper
import "fmt"
// ClientError is an error for a specific client
type ClientError struct {
Client *Client
error error
}
// Error returns the error message as a string
func (ce ClientError) Error() string {
return ce.error.Error()
}
// Unwrap returns the underlying error.
func (ce ClientError) Unwrap() error {
return ce.error
}
// ChannelClosedError indicates the channel has been closed and cannot be used.
type ChannelClosedError struct {
Channel string
}
// Error returns the error message as a string.
func (e ChannelClosedError) Error() string {
if e.Channel == "" {
return "channel is closed"
}
return fmt.Sprintf("channel '%s' is closed", e.Channel)
}