From d68dd365321764aceaf4e37a106a519797926495 Mon Sep 17 00:00:00 2001 From: Sarfaraz Nawaz Date: Mon, 6 Jul 2020 21:30:48 +0530 Subject: [PATCH] feat(codec): Improve compression flag log (#374) --- tonic/src/codec/decode.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tonic/src/codec/decode.rs b/tonic/src/codec/decode.rs index 651a90328..88545dfec 100644 --- a/tonic/src/codec/decode.rs +++ b/tonic/src/codec/decode.rs @@ -168,10 +168,15 @@ impl Streaming { } f => { trace!("unexpected compression flag"); - return Err(Status::new( - Code::Internal, - format!("Unexpected compression flag: {}", f), - )); + let message = if let Direction::Response(status) = self.direction { + format!( + "Unexpected compression flag: {}, while receiving response with status: {}", + f, status + ) + } else { + format!("Unexpected compression flag: {}, while sending request", f) + }; + return Err(Status::new(Code::Internal, message)); } }; let len = self.buf.get_u32() as usize;