Commit 5d1e9168 authored by Levin Zimmermann's avatar Levin Zimmermann

neonet += ErrUnexpectedMsg to propagate msg type

parent cc96af58
......@@ -231,6 +231,15 @@ var ErrLinkNoListen = errors.New("node link is not listening for incoming connec
var ErrLinkManyConn = errors.New("too many opened connections")
var ErrClosedConn = errors.New("connection is closed")
type ErrUnexpectedMsg struct {
Msg string
MsgType reflect.Type
}
func (e *ErrUnexpectedMsg) Error() string {
return fmt.Sprintf("%s %v", e.Msg, e.MsgType)
}
// LinkError is returned by NodeLink operations.
type LinkError struct {
Link *NodeLink
......@@ -1600,7 +1609,7 @@ func (c *Conn) Expect(msgv ...proto.Msg) (which int, err error) {
}
// XXX also add which messages were expected ?
return -1, c.err("recv", fmt.Errorf("unexpected message: %v", msgType))
return -1, c.err("recv", &ErrUnexpectedMsg{"unexpected message", msgType})
}
// 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