forked from googollee/go-socket.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
37 lines (28 loc) · 736 Bytes
/
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
package socketio
import (
"errors"
"fmt"
)
// connect errors.
var (
errUnavailableRootHandler = errors.New("root ('/') doesn't have a namespace handler")
errFailedConnectNamespace = errors.New("failed connect to namespace without handler")
)
// common connection dispatch errors.
var (
errHandleDispatch = errors.New("handler dispatch error")
errDecodeArgs = errors.New("decode args error")
)
type errorMessage struct {
namespace string
err error
}
func (e errorMessage) Error() string {
return fmt.Sprintf("error in namespace: (%s) with error: (%s)", e.namespace, e.err.Error())
}
func newErrorMessage(namespace string, err error) *errorMessage {
return &errorMessage{
namespace: namespace,
err: err,
}
}