-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResponseErrorException is not propagated with the default exception handler #802
Comments
Can I confirm that the use case you are seeing is that you are getting the "wrong" |
By wrapping ResponseErrorException with another layer in RuntimeException it means the unwrapping of the exception in RemoteEndpoint.DEFAULT_EXCEPTION_HANDLER doesn't work as expected and instead of getting the original ResponseError the other end gets the fallback ResponseError of type internal error. Fixes #802
By wrapping ResponseErrorException with another layer in RuntimeException it means the unwrapping of the exception in RemoteEndpoint.DEFAULT_EXCEPTION_HANDLER doesn't work as expected and instead of getting the original ResponseError the other end gets the fallback ResponseError of type internal error. This change includes updates to documentation to show that it is ok to throw ResponseErrorException (reverts #578). While it is also OK to return an exceptionally completed future, it is not needed to do that way and simply throwing is more straightforward. There are new tests to cover the changed handling. Also tested is the previously documented way of handling exceptions (see `tries == 1` case in `testVersatility` and `testVersatilityResponseError` Fixes #802
Yes a new lsp4j/org.eclipse.lsp4j.jsonrpc/src/main/java/org/eclipse/lsp4j/jsonrpc/RemoteEndpoint.java Line 62 in 88868d3
|
Thanks for confirming. I think that the PR I provided will resolve this case. Thanks for pointing out the secondary problem of the SEVERE log message too. |
By wrapping ResponseErrorException with another layer in RuntimeException it means the unwrapping of the exception in RemoteEndpoint.DEFAULT_EXCEPTION_HANDLER doesn't work as expected and instead of getting the original ResponseError the other end gets the fallback ResponseError of type internal error. This change includes updates to documentation to show that it is ok to throw ResponseErrorException (reverts #578). While it is also OK to return an exceptionally completed future, it is not needed to do that way and simply throwing is more straightforward. There are new tests to cover the changed handling. Also tested is the previously documented way of handling exceptions (see `tries == 1` case in `testVersatility` and `testVersatilityResponseError` Fixes #802 Also-by: Vladimir Piskarev <pisv@1c.ru>
This exception is thrown when the endpoint is created, not as a result of a receiving a message. This is generally a coding error, so make this exception the same as the other exceptions thrown by recursiveFindRpcMethods. Included is adding additional tests to ensure coverage of some previously missing uses cases. Code cleanup done as part of #802
By wrapping ResponseErrorException with another layer in RuntimeException it means the unwrapping of the exception in RemoteEndpoint.DEFAULT_EXCEPTION_HANDLER doesn't work as expected and instead of getting the original ResponseError the other end gets the fallback ResponseError of type internal error. This change includes updates to documentation to show that it is ok to throw ResponseErrorException (reverts #578). While it is also OK to return an exceptionally completed future, it is not needed to do that way and simply throwing is more straightforward. There are new tests to cover the changed handling. Also tested is the previously documented way of handling exceptions (see `tries == 1` case in `testVersatility` and `testVersatilityResponseError` Fixes #802 Also-by: Vladimir Piskarev <pisv@1c.ru>
This exception is thrown when the endpoint is created, not as a result of a receiving a message. This is generally a coding error, so make this exception the same as the other exceptions thrown by recursiveFindRpcMethods. Included is adding additional tests to ensure coverage of some previously missing uses cases. Code cleanup done as part of #802
The same as: #576
But by then only the doc had changed: #578
In my opinion this is not very user friendly. If I bother to throw a
ResponseErrorException
, it should be propagated even if it is thrown when the method is called and not only when theCompletableFuture
is executed.As an example, we do check some context stuff that is only available as a
ThreadLocal
and not while theCompletableFuture
is executed.There is also an open source example on eclpse-gslp that does this incorrectly. See DefaultGLSPServer
The text was updated successfully, but these errors were encountered: