Repository navigation
How can I send error details to the client? #3948
|
We are using Redis for invocation: In the client side, we have implemented IInvoker and put the OutgoingRequest into Redis stream, and the server reads the IncomingRequest from Redis stream and uses DispatchAsync to call the corresponding method. The problem is when we raise an exception within the method, DispatchAsync raises the exception on the server side, but we expect it to create an OutgoingResponse containing the error StatusCode and ErrorMessage so that we can put in Redis, and the error raises on the client side. Is there a way to do it? |
Replies: 0 comments 3 replies
|
Hi Kamyar, So you've essentially implemented a new "redis" protocol, alongside the
Yes, you can easily create an OutgoingResponse from a DispatchException. That's what IceRpcProtocolConnection does here:
Maybe you could open a PR to convert it into a public extension method? All the best, |
|
Wrapping the exception within DispatchException did the trick! Thank you! |
Hi Kamyar,
So you've essentially implemented a new "redis" protocol, alongside the
iceandicerpcprotocols that IceRPC provides. I didn't anticipate replacing the protocol would be a common use-case.Yes, you can easily create an OutgoingResponse from a DispatchException. That's what IceRpcProtocolConnection does here:
icerpc-csharp/src/IceRpc/Internal/IceRpcProtocolConnection.cs
Line 1221 in c62195b
ToOutgoingResponseis an internal extension method:icerpc-csharp/src/IceRpc/Internal/DispatchExceptionExtensions.cs
Line 6 in c62195b
Maybe you could open a PR to conve…