This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
fix(rome_cli): improve the logging of panics and connection errors #3957
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3920
This is a followup to #3952 adding additional logs to the CLI and VSCode extension. Specifically, it extends the panic hook of the CLI to print the panic message to the current tracing log file in addition to stderr. This ensures that panic messages can be retrieved in the logs when they cause a background process like the language server to crash.
In addition to this, I extended the previous changes to the VSCode extension to wrap errors thrown by the
connect
function in addition to the exceptions raised by the socket itself. I also improved thegetSocket
function by collecting the content of the stderr pipe for the CLI child process in addition to stdout, and to fail with an error if the content of stdout was empty. This error will now include the exit code of the CLI as well as the content of stderr if it was not empty.Test Plan
I tested these changes locally by introducing explicit panics in the
print_socket
andrun_daemon
functions to ensure that the panic is correctly getting logged to the tracing log file, and that the extension correctly prints the content of stderr if the CLI instance exits with an error.