mirror of https://github.com/grpc/grpc-node.git
Make error messages match core
This commit is contained in:
parent
413dcd764b
commit
38ebfc8760
|
@ -44,7 +44,7 @@ export class MaxMessageSizeFilter extends BaseFilter implements Filter {
|
|||
} else {
|
||||
const concreteMessage = await message;
|
||||
if (concreteMessage.message.length > this.maxSendMessageSize) {
|
||||
this.callStream.cancelWithStatus(Status.RESOURCE_EXHAUSTED, `Failed to send message of size ${concreteMessage.message.length} > max size ${this.maxSendMessageSize}`);
|
||||
this.callStream.cancelWithStatus(Status.RESOURCE_EXHAUSTED, `Sent message larger than max (${concreteMessage.message.length} vs. ${this.maxSendMessageSize})`);
|
||||
return Promise.reject<WriteObject>('Message too large');
|
||||
} else {
|
||||
return concreteMessage;
|
||||
|
@ -60,7 +60,7 @@ export class MaxMessageSizeFilter extends BaseFilter implements Filter {
|
|||
} else {
|
||||
const concreteMessage = await message;
|
||||
if (concreteMessage.length > this.maxReceiveMessageSize) {
|
||||
this.callStream.cancelWithStatus(Status.RESOURCE_EXHAUSTED, `Received message of size ${concreteMessage.length} > max size ${this.maxReceiveMessageSize}`);
|
||||
this.callStream.cancelWithStatus(Status.RESOURCE_EXHAUSTED, `Received message larger than max (${concreteMessage.length} vs. ${this.maxReceiveMessageSize})`);
|
||||
return Promise.reject<Buffer>('Message too large');
|
||||
} else {
|
||||
return concreteMessage;
|
||||
|
|
|
@ -449,7 +449,7 @@ export class Http2ServerCallStream<
|
|||
if (this.maxReceiveMessageSize !== -1 && requestBytes.length > this.maxReceiveMessageSize) {
|
||||
this.sendError({
|
||||
code: Status.RESOURCE_EXHAUSTED,
|
||||
details: `Server received message of size ${requestBytes.length} > max size ${this.maxReceiveMessageSize}`
|
||||
details: `Received message larger than max (${requestBytes.length} vs. ${this.maxReceiveMessageSize})`
|
||||
});
|
||||
resolve();
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ export class Http2ServerCallStream<
|
|||
if (this.maxSendMessageSize !== -1 && chunk.length > this.maxSendMessageSize) {
|
||||
this.sendError({
|
||||
code: Status.RESOURCE_EXHAUSTED,
|
||||
details: `Server failed to send message of size ${chunk.length} > max size ${this.maxSendMessageSize}`
|
||||
details: `Sent message larger than max (${chunk.length} vs. ${this.maxSendMessageSize})`
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ export class Http2ServerCallStream<
|
|||
if (this.maxReceiveMessageSize !== -1 && message.length > this.maxReceiveMessageSize) {
|
||||
this.sendError({
|
||||
code: Status.RESOURCE_EXHAUSTED,
|
||||
details: `Server received message of size ${message.length} > max size ${this.maxReceiveMessageSize}`
|
||||
details: `Received message larger than max (${message.length} vs. ${this.maxReceiveMessageSize})`
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue