-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
fix: improve error handling for compiler diagnostics #165
Conversation
@@ -24,7 +24,7 @@ defmodule NextLS.ElixirExtension do | |||
end | |||
|
|||
@impl GenServer | |||
def handle_info({:compiler, diagnostics}, state) do | |||
def handle_info({:compiler, diagnostics}, state) when is_list(diagnostics) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll need to handle an unhandled messaged, and emit a warning log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed some changes/fixes for this branch. At this point, I don't think we need to handle unexpected messages here because this should always be a list. Prior to these changes, if there was an RPC call failure, this might be like a :nodedown message or something, which was then causing a more confusing downstream error.
At this point, this guard is basically just a safety net so that, if an invalid message is sent, it's more obvious/clear in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to add: I'm fine either removing this guard or adding a catch-all for unhandled messages, but I personally think it's okay to be assertive here.
Looks alright, could you add a test or two? |
just a test in the elixir_extension_test.exs is fine, would be too hard to simulate in an integration tests (the tests that use the GenLSP.Test helpers) |
edcc86a
to
35c64b9
Compare
This should hopefully help with the tests, as they often spit out "blah blah overlapping partitions blah blah" with regard to the clustered nodes that are started. In test, we start many many nodes all connected to the main node, which is the test application. Copied some code from @zachallaun from #165 Co-authored-by: Zach Allaun <[email protected]>
fix(runtime): don't crash if compile is called before ready test(runtime): rgroup related tests in describe blocks
…shutting down runtime
Playing around with Next LS this morning and was running up against some issues compiling a project of mine. I think the previous handling of
:badrpc
errors was incorrect, which was hiding certain errors of causing them to bubble up in weird ways (like trying iterate over an atom).