Skip to content
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(daemon): Add context to error when unable to connect #2394

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

jeremycline
Copy link
Contributor

@jeremycline jeremycline commented Sep 21, 2024

Recently, it seems, the socket location for the daemon moved and this caused me to scratch my head briefly since I saw errors from the client connecting to the daemon, but the daemon was clearly running and the socket seemed to exist.

This patch includes more context when the client fails to connect to the daemon. The path is included to help the user understand where the client was looking, and wrap_err_with() is used to show the user the cause of the error. This changes the error message from:

Error: failed to connect to local atuin daemon. Is it running?

to:

Error: failed to connect to local atuin daemon at /run/user/1001/atuin.sock. Is it running?

Caused by:
   0: transport error
   1: No such file or directory (os error 2)
   2: No such file or directory (os error 2)

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

Recently, it seems, the socket location for the daemon moved and this
caused me to scratch my head briefly since I saw errors from the client
connecting to the daemon, but the daemon was clearly running and the
socket seemed to exist.

This patch includes more context when the client fails to connect to the
daemon. The path is included to help the user understand where the
client was looking, and `wrap_err_with()` is used to show the user the
cause of the error. This changes the error message from:

Error: failed to connect to local atuin daemon. Is it running?

to:

Error: failed to connect to local atuin daemon at /run/user/1001/atuin.sock. Is it running?

Caused by:
   0: transport error
   1: No such file or directory (os error 2)
   2: No such file or directory (os error 2)
Copy link
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

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

Recently, it seems, the socket location for the daemon moved

Huh that's weird. It should not have moved 🤔

But yes otherwise this totally makes sense, thank you

@ellie ellie merged commit 80e950c into atuinsh:main Oct 3, 2024
19 checks passed
@jeremycline
Copy link
Contributor Author

Recently, it seems, the socket location for the daemon moved

Huh that's weird. It should not have moved 🤔

I admit I didn't spend enough time looking at exactly why I hit this error; it's likely my systemd unit does something silly. Anyway, thanks!

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