Implement net.Error on timeout errors.

Fixes #10.
This commit is contained in:
Gary Burd 2013-12-23 12:01:25 -08:00
parent 7274f97ac5
commit 67d178946a
2 changed files with 13 additions and 1 deletions

12
conn.go
View File

@ -65,9 +65,19 @@ var (
ErrReadLimit = errors.New("websocket: read limit exceeded")
)
type websocketError struct {
msg string
temporary bool
timeout bool
}
func (e *websocketError) Error() string { return e.msg }
func (e *websocketError) Temporary() bool { return e.temporary }
func (e *websocketError) Timeout() bool { return e.timeout }
var (
errWriteTimeout = &websocketError{msg: "websocket: write timeout", timeout: true}
errBadWriteOpCode = errors.New("websocket: bad write message type")
errWriteTimeout = errors.New("websocket: write timeout")
errWriteClosed = errors.New("websocket: write closed")
errInvalidControlFrame = errors.New("websocket: invalid control frame")
)

View File

@ -15,6 +15,8 @@ import (
"time"
)
var timeoutErrImplementsNetError net.Error = errWriteTimeout
type fakeNetConn struct {
io.Reader
io.Writer