Skip to content

Allow method handlers to return json rpc errors#20

Merged
ccordoba12 merged 3 commits into
python-lsp:developfrom
smacke:allow-error-response
Sep 7, 2023
Merged

Allow method handlers to return json rpc errors#20
ccordoba12 merged 3 commits into
python-lsp:developfrom
smacke:allow-error-response

Conversation

@smacke

@smacke smacke commented Sep 6, 2023

Copy link
Copy Markdown
Contributor

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

smacke commented Sep 7, 2023

Copy link
Copy Markdown
Contributor Author

@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

@ccordoba12 ccordoba12 left a comment

Copy link
Copy Markdown
Member

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