api/handler/rpc: fix panic on invalid error conversation (#1483)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-04-04 00:55:15 +03:00
parent 281cced325
commit bad15af45d

View File

@ -183,17 +183,17 @@ func writeLoop(rw io.ReadWriter, stream client.Stream) {
default: default:
buf, op, err := wsutil.ReadClientData(rw) buf, op, err := wsutil.ReadClientData(rw)
if err != nil { if err != nil {
wserr := err.(wsutil.ClosedError) if wserr, ok := err.(wsutil.ClosedError); ok {
switch wserr.Code { switch wserr.Code {
case ws.StatusNormalClosure, ws.StatusNoStatusRcvd: case ws.StatusNormalClosure, ws.StatusNoStatusRcvd:
return return
default: }
}
if logger.V(logger.ErrorLevel, logger.DefaultLogger) { if logger.V(logger.ErrorLevel, logger.DefaultLogger) {
logger.Error(err) logger.Error(err)
} }
return return
} }
}
switch op { switch op {
default: default:
// not relevant // not relevant