-
Notifications
You must be signed in to change notification settings - Fork 37
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
improve error messages for network connection failures #232
improve error messages for network connection failures #232
Conversation
Signed-off-by: Matt Butcher <[email protected]>
src/client/error.rs
Outdated
InvalidRequest { | ||
status_code: reqwest::StatusCode, | ||
message: Option<String>, | ||
}, | ||
/// A server error was encountered. Contains an optional message from the server | ||
#[error("Server has encountered an error: {0:?}")] | ||
#[error("Server has encountered an error: {}", .0.clone().unwrap_or_else(||"Protocol error. Verify the Bindle URL".to_owned()))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what you said this could result from the wrong port or from a network disconnect? If so I feel like "Server has encountered an error" may send people down the wrong path here... but also very hard to get clear wording for what could be a wide range of cases that are hard to tell apart!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "Networking error: {}" would be more accurate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! "Error contacting server"
Signed-off-by: Matt Butcher <[email protected]>
@technosophos Did you need any more feedback here or can we merge? |
Merge away. I forgot about this PR |
This traps networking errors and makes a noble effort to be informative.
Most, if not all, network errors will be due to either network failure or pointing at the wrong URL. This PR tries to catch those that result in hitting the wrong URL.
Server responds 400 BAD REQUEST:
A networking error occurred during connection (e.g. wrong port, server disconnects abruptly):
Closes #231
Signed-off-by: Matt Butcher [email protected]