dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Feature] onError in Streaming Mode Does Not Support Returning Custom Exceptions

Open nikbobo opened this issue 1 year ago • 6 comments

Pre-check

  • [X] I am sure that all the content I provide is in English.

Search before asking

  • [X] I had searched in the issues and found no similar feature requirement.

Apache Dubbo Component

Java SDK (apache/dubbo)

Descriptions

It is expected that the onError method of StreamObserver can pass through custom exceptions to the Consumer. Currently, the onError method in ServerCallToObserverAdapter is as follows:

public void onError(Throwable throwable) {
    final TriRpcStatus status = TriRpcStatus.getStatus(throwable);
    onCompleted(status);
}

This ultimately returns a StatusRpcException.

Related issues

No response

Are you willing to submit a pull request to fix on your own?

  • [ ] Yes I am willing to submit a pull request on my own!

Code of Conduct

nikbobo avatar Jul 10 '24 07:07 nikbobo

@EarthChen PTAL

AlbumenJ avatar Jul 12 '24 12:07 AlbumenJ

Yeah, we haven't figured out how to support it yet

EarthChen avatar Jul 12 '24 13:07 EarthChen

@nikbobo I have great interest about this issue, could you assign it to me?

elysium-w avatar Aug 02 '24 09:08 elysium-w

@nikbobo I have great interest about this issue, could you assign it to me?

I cannot assign to anyone, please contact project admin.

nikbobo avatar Aug 05 '24 00:08 nikbobo

@elysium-w Sure, but please write a brief proposal before coding.

oxsean avatar Aug 05 '24 01:08 oxsean

I think this requirement is unreasonable. Dubbo's stream is align to gRPC. In gRPC, if StreamObserver.onError is called within a stream, the error information is written back to the client via trailers, and the Throwable is not passed. then the stream is closed. A point we can optimization is provide extension that allow users to write additional error information back to the client.

oxsean avatar Aug 05 '24 04:08 oxsean