Skip to content

Fix log message flow #523

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/ruby_lsp/ruby_lsp_rails/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def send_message(message)
# Log a message to the editor's output panel
def log_message(message)
$stderr.puts(message)
send_message({ result: nil })
end
end

Expand Down Expand Up @@ -135,10 +134,13 @@ def execute(request, params)
# Since this is a common problem, we show a specific error message to the user, instead of the full stack trace.
rescue ActiveRecord::ConnectionNotEstablished
log_message("Request #{request_name} failed because database connection was not established.")
send_message({ result: nil })
rescue ActiveRecord::NoDatabaseError
log_message("Request #{request_name} failed because the database does not exist.")
send_message({ result: nil })
rescue => e
log_message("Request #{request_name} failed:\n" + e.full_message(highlight: false))
send_message({ result: nil })
end

private
Expand Down
Loading