Skip to content

Allow method handlers to return json rpc errors #20

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

Merged
merged 3 commits into from
Sep 7, 2023

Conversation

smacke
Copy link
Contributor

@smacke smacke commented Sep 6, 2023

In this PR, we allow method handlers to return results that could themselves contain "result" and "error" fields. If they contain neither field, the old behavior is maintained. If they contain one or both fields, however, we read those fields and use them in the json rpc response.

This will be useful for addressing python-lsp/python-lsp-server#314 -- rather than raising an exception when we get a request post-shutdown, we'll be able to instead call a method that returns a json rpc invalid request.

See also python-lsp/python-lsp-server#432

@smacke
Copy link
Contributor Author

smacke commented Sep 7, 2023

@ccordoba12 I noticed a bug and it looks like CI caught it as well; pushed a fix and it should hopefully pass now if you kick it.

@ccordoba12 ccordoba12 added this to the v1.1.0 milestone Sep 7, 2023
@ccordoba12 ccordoba12 changed the title allow method handlers to return json rpc errors Allow method handlers to return json rpc errors Sep 7, 2023
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for your help with this @smacke!

@ccordoba12 ccordoba12 merged commit b0331b7 into python-lsp:develop Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants