-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
errors.go
74 lines (60 loc) · 1.88 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package centrifuge
import (
"errors"
"fmt"
)
var (
// ErrTimeout returned if operation timed out.
ErrTimeout = errors.New("timeout")
// ErrClientDisconnected can be returned if client goes to
// disconnected state while operation in progress.
ErrClientDisconnected = errors.New("client disconnected")
// ErrClientClosed can be returned if client is closed.
ErrClientClosed = errors.New("client closed")
// ErrSubscriptionUnsubscribed returned if Subscription is unsubscribed.
ErrSubscriptionUnsubscribed = errors.New("subscription unsubscribed")
// ErrDuplicateSubscription returned if subscription to the same channel
// already registered in current client instance. This is due to the fact
// that server does not allow subscribing to the same channel twice for
// the same connection.
ErrDuplicateSubscription = errors.New("duplicate subscription")
// ErrUnauthorized is a special error which may be returned by application
// from GetToken function to indicate lack of operation permission.
ErrUnauthorized = errors.New("unauthorized")
)
type TransportError struct {
Err error
}
func (t TransportError) Error() string {
return fmt.Sprintf("transport error: %v", t.Err)
}
type ConnectError struct {
Err error
}
func (c ConnectError) Error() string {
return fmt.Sprintf("connect error: %v", c.Err)
}
type RefreshError struct {
Err error
}
func (r RefreshError) Error() string {
return fmt.Sprintf("refresh error: %v", r.Err)
}
type ConfigurationError struct {
Err error
}
func (r ConfigurationError) Error() string {
return fmt.Sprintf("configuration error: %v", r.Err)
}
type SubscriptionSubscribeError struct {
Err error
}
func (s SubscriptionSubscribeError) Error() string {
return fmt.Sprintf("subscribe error: %v", s.Err)
}
type SubscriptionRefreshError struct {
Err error
}
func (s SubscriptionRefreshError) Error() string {
return fmt.Sprintf("refresh error: %v", s.Err)
}