From 80f838c9cebe3829c7f13eee6643d81b1f49daa3 Mon Sep 17 00:00:00 2001 From: Aman Karmani Date: Sat, 28 Sep 2024 14:32:30 -0700 Subject: [PATCH 1/2] Add details about underlying message types on input message protocol errors Signed-off-by: Aman Karmani --- .../src/protocol/invoke-implementation.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/connect/src/protocol/invoke-implementation.ts b/packages/connect/src/protocol/invoke-implementation.ts index 2cdc1bfba..70e9ca262 100644 --- a/packages/connect/src/protocol/invoke-implementation.ts +++ b/packages/connect/src/protocol/invoke-implementation.ts @@ -151,6 +151,14 @@ export function transformInvokeImplementation< throw new ConnectError( "protocol error: received extra input message for unary method", Code.Unimplemented, + { + methodName: spec.method.name, + serviceTypeName: spec.service.typeName, + inputTypeName: spec.method.I.typeName, + outputTypeName: spec.method.O.typeName, + url: context.url, + requestMethod: context.requestMethod, + } ); } }; @@ -162,6 +170,14 @@ export function transformInvokeImplementation< throw new ConnectError( "protocol error: missing input message for server-streaming method", Code.Unimplemented, + { + methodName: spec.method.name, + serviceTypeName: spec.service.typeName, + inputTypeName: spec.method.I.typeName, + outputTypeName: spec.method.O.typeName, + url: context.url, + requestMethod: context.requestMethod, + } ); } const anyFn = async ( @@ -209,6 +225,14 @@ export function transformInvokeImplementation< throw new ConnectError( "protocol error: received extra input message for server-streaming method", Code.Unimplemented, + { + methodName: spec.method.name, + serviceTypeName: spec.service.typeName, + inputTypeName: spec.method.I.typeName, + outputTypeName: spec.method.O.typeName, + url: context.url, + requestMethod: context.requestMethod, + } ); } }; From 91d23eea84ddcd3b010a97bd3897bfba8c2b03d0 Mon Sep 17 00:00:00 2001 From: Aman Karmani Date: Sat, 28 Sep 2024 15:07:57 -0700 Subject: [PATCH 2/2] annotate the error message too --- packages/connect/src/protocol/invoke-implementation.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/connect/src/protocol/invoke-implementation.ts b/packages/connect/src/protocol/invoke-implementation.ts index 70e9ca262..c475cb02f 100644 --- a/packages/connect/src/protocol/invoke-implementation.ts +++ b/packages/connect/src/protocol/invoke-implementation.ts @@ -149,7 +149,7 @@ export function transformInvokeImplementation< const input2 = await inputIt.next(); if (input2.done !== true) { throw new ConnectError( - "protocol error: received extra input message for unary method", + `protocol error: received extra input message ${spec.method.I.typeName} for unary method ${spec.method.name}`, Code.Unimplemented, { methodName: spec.method.name, @@ -168,7 +168,7 @@ export function transformInvokeImplementation< const input1 = await inputIt.next(); if (input1.done === true) { throw new ConnectError( - "protocol error: missing input message for server-streaming method", + `protocol error: missing input message ${spec.method.I.typeName} for server-streaming method ${spec.method.name}`, Code.Unimplemented, { methodName: spec.method.name, @@ -223,7 +223,7 @@ export function transformInvokeImplementation< const input2 = await inputIt.next(); if (input2.done !== true) { throw new ConnectError( - "protocol error: received extra input message for server-streaming method", + `protocol error: received extra input message ${spec.method.I.typeName} for server-streaming method ${spec.method.name}`, Code.Unimplemented, { methodName: spec.method.name,