eclipse-lsp4j / lsp4j

A Java implementation of the language server protocol intended to be consumed by tools and language servers implemented in Java.

Home Page:https://eclipse.org/lsp4j

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ResponseErrorException is not propagated with the default exception handler

ivy-cst opened this issue · comments

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 the CompletableFuture is executed.

As an example, we do check some context stuff that is only available as a ThreadLocal and not while the CompletableFuture is executed.

There is also an open source example on eclpse-gslp that does this incorrectly. See DefaultGLSPServer

Can I confirm that the use case you are seeing is that you are getting the "wrong" ResponseError back? Instead of getting the ResponseError with the code, message and data that you expect you are getting an Internal error message/code and the data is the stack trace?

Can I confirm that the use case you are seeing is that you are getting the "wrong" ResponseError back? Instead of getting the ResponseError with the code, message and data that you expect you are getting an Internal error message/code and the data is the stack trace?

Yes a new ResponseError is generated and even worse the exception is logged as SEVERE here:

LOG.log(Level.SEVERE, header + ": " + throwable.getMessage(), throwable);

Yes a new ResponseError is generated [...]

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.