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

feat: add a user-friendly message for AddrInUse error #233

Merged
merged 2 commits into from
Mar 7, 2025

Conversation

m4tx
Copy link
Member

@m4tx m4tx commented Mar 7, 2025

Fixes #227

@m4tx m4tx requested a review from seqre March 7, 2025 09:34
Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 83.92857% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cot/src/cli.rs 83.92% 8 Missing and 1 partial ⚠️
Flag Coverage Δ
rust 78.78% <83.92%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cot/src/cli.rs 75.54% <83.92%> (+2.44%) ⬆️
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@seqre seqre left a comment

Choose a reason for hiding this comment

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

One comment, otherwise LGTM

let result = crate::run(bootstrapper, &addr_port).await;
if let Err(error) = &result {
if let Some(user_friendly_error) = Self::get_user_friendly_error(error, &addr_port) {
eprintln!("{user_friendly_error}");
Copy link
Member

Choose a reason for hiding this comment

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

If we handled a specific error, shouldn't we exit early here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think (I might be wrong) that it still makes sense to print out the entire error structure anyways for debugging purposes. Also, this gives a chance to cleanup the stack with RAII as opposed to std::process::exit which terminates instantly.

@seqre seqre merged commit abeee69 into master Mar 7, 2025
29 checks passed
@seqre seqre deleted the user-friendly-addr-in-use branch March 7, 2025 11:49
@cotbot cotbot bot mentioned this pull request Mar 7, 2025
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.

bacon serve paniced
2 participants