Currently RSocket requester receives only ApplicationErrorException when server throws say IllegalArugmentException or any custom exception.
Now there is no way to clearly communicate the error to the requester!
Can you provide any workaround / add support?
Comment From: rstoyanchev
What support would you like to see and which exceptions do you mean? For example custom application exceptions can be intercepted with @MessageExceptionHandler
methods in addition to operators like onErrorResume
.
Comment From: kitkars
@rstoyanchev , Thanks for responding. @MessageExceptionHandler works fine in the controller level. It does not work with @ControllerAdvice which is a separate issue I created here - https://github.com/spring-projects/spring-framework/issues/26636. But it is on server side.
However, on the client side, which is a separate application, sees everything as ApplicationErrorException. I think we need something like gRPC status codes here.
https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
Comment From: rstoyanchev
I see. I don't think a client-side mechanism for this makes sense. The client would have to make guesses about the nature of the error and for that there is not enough information available (just an exception message). On top of that, assumptions would be brittle since they depend on language and implementation details. This has to be something well defined that the server sends and the client understands.
RSocket does have well-defined ERROR frame codes in the RSocket protocol represented through the RSocketErrorException
hierarchy but ApplicationErrorException
is perhaps too broad for all types of application errors and perhaps could be improved.
This is broader than Spring however, and I see there is https://github.com/rsocket/rsocket/issues/282. So I'm closing this issue in favor of that. Please, do contribute over there your ideas about what codes you'd like to see.