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

Add friendly error messages for IO errors #5

Open
ruuda opened this issue Jul 22, 2024 · 0 comments
Open

Add friendly error messages for IO errors #5

ruuda opened this issue Jul 22, 2024 · 0 comments
Labels
bootcamp Good for newcomers enhancement New feature or request

Comments

@ruuda
Copy link
Contributor

ruuda commented Jul 22, 2024

Follow-up to this comment:

Currently we use io::Result in most places. These errors are not user-friendly, because they lose context about the file that we had a problem with (if it’s a file at all).

Also, all propagated errors get “handled” in main like so:

fastsync/src/main.rs

Lines 82 to 91 in cfba4cc

Some("send") if args.len() >= 3 => {
let addr = &args[1];
let fnames = &args[2..];
main_send(addr, fnames).expect("Failed to send.");
}
Some("recv") if args.len() == 3 => {
let addr = &args[1];
let n_conn = &args[2];
main_recv(addr, n_conn).expect("Failed to receive.");
}

I think it’s okay to crash the application in case of an IO error — I don’t think we need to be robust against transient failures, the user can just restart the transfer instead — but we can report clearly what went wrong and where.

@ruuda ruuda added bootcamp Good for newcomers enhancement New feature or request labels Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bootcamp Good for newcomers enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant