Commit 995a128c authored by Levin Zimmermann's avatar Levin Zimmermann

fixup! neonet += ErrUnexpectedMsg to propagate msg type

parent 5d1e9168
...@@ -232,12 +232,13 @@ var ErrLinkManyConn = errors.New("too many opened connections") ...@@ -232,12 +232,13 @@ var ErrLinkManyConn = errors.New("too many opened connections")
var ErrClosedConn = errors.New("connection is closed") var ErrClosedConn = errors.New("connection is closed")
type ErrUnexpectedMsg struct { type ErrUnexpectedMsg struct {
Msg string ErrorMsg string
MsgType reflect.Type MsgCode uint16
Msg proto.Msg
} }
func (e *ErrUnexpectedMsg) Error() string { func (e *ErrUnexpectedMsg) Error() string {
return fmt.Sprintf("%s %v", e.Msg, e.MsgType) return fmt.Sprintf("%s %v", e.ErrorMsg, proto.MsgType(e.MsgCode))
} }
// LinkError is returned by NodeLink operations. // LinkError is returned by NodeLink operations.
...@@ -1609,7 +1610,7 @@ func (c *Conn) Expect(msgv ...proto.Msg) (which int, err error) { ...@@ -1609,7 +1610,7 @@ func (c *Conn) Expect(msgv ...proto.Msg) (which int, err error) {
} }
// XXX also add which messages were expected ? // XXX also add which messages were expected ?
return -1, c.err("recv", &ErrUnexpectedMsg{"unexpected message", msgType}) return -1, c.err("recv", &ErrUnexpectedMsg{"unexpected message", msgCode, msgv[0]})
} }
// Ask sends request and receives a response. // Ask sends request and receives a response.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment