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")
var ErrClosedConn = errors.New("connection is closed")
type ErrUnexpectedMsg struct {
Msg string
MsgType reflect.Type
ErrorMsg string
MsgCode uint16
Msg proto.Msg
}
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.
......@@ -1609,7 +1610,7 @@ func (c *Conn) Expect(msgv ...proto.Msg) (which int, err error) {
}
// 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.
......
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