core: clarify exception message

Reformulate message to highlight that SizeEnforcingInputStream is
applied on the message size of the message after decompression.
This commit is contained in:
Brice Jaglin 2021-04-16 12:43:55 +02:00 committed by Eric Anderson
parent ffebe231c0
commit 62fafe7eda
2 changed files with 5 additions and 5 deletions

View File

@ -517,8 +517,8 @@ public class MessageDeframer implements Closeable, Deframer {
private void verifySize() { private void verifySize() {
if (count > maxMessageSize) { if (count > maxMessageSize) {
throw Status.RESOURCE_EXHAUSTED.withDescription(String.format( throw Status.RESOURCE_EXHAUSTED.withDescription(String.format(
"Compressed gRPC message exceeds maximum size %d: %d bytes read", "Decompressed gRPC message exceeds maximum size %d",
maxMessageSize, count)).asRuntimeException(); maxMessageSize)).asRuntimeException();
} }
} }
} }

View File

@ -378,7 +378,7 @@ public class MessageDeframerTest {
try { try {
thrown.expect(StatusRuntimeException.class); thrown.expect(StatusRuntimeException.class);
thrown.expectMessage("RESOURCE_EXHAUSTED: Compressed gRPC message exceeds"); thrown.expectMessage("RESOURCE_EXHAUSTED: Decompressed gRPC message exceeds");
while (stream.read() != -1) { while (stream.read() != -1) {
} }
@ -424,7 +424,7 @@ public class MessageDeframerTest {
try { try {
thrown.expect(StatusRuntimeException.class); thrown.expect(StatusRuntimeException.class);
thrown.expectMessage("RESOURCE_EXHAUSTED: Compressed gRPC message exceeds"); thrown.expectMessage("RESOURCE_EXHAUSTED: Decompressed gRPC message exceeds");
stream.read(buf, 0, buf.length); stream.read(buf, 0, buf.length);
} finally { } finally {
@ -467,7 +467,7 @@ public class MessageDeframerTest {
try { try {
thrown.expect(StatusRuntimeException.class); thrown.expect(StatusRuntimeException.class);
thrown.expectMessage("RESOURCE_EXHAUSTED: Compressed gRPC message exceeds"); thrown.expectMessage("RESOURCE_EXHAUSTED: Decompressed gRPC message exceeds");
stream.skip(4); stream.skip(4);
} finally { } finally {