1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

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

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Vasiliy Tolstov 2020-04-04 00:55:15 +03:00 committed by GitHub
parent 38aed6f0f6
commit bc7579f1d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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