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(ws client): improve error message bad URL #642

Merged
merged 4 commits into from
Jan 6, 2022

Conversation

niklasad1
Copy link
Member

Fixes/improves the error message when a bad URL is detected

Partly addresses #638 to print an error when an absolute URI
in a redirection couldn't be parsed as a WS target.

@niklasad1 niklasad1 requested a review from a team as a code owner January 6, 2022 09:45
Comment on lines 442 to 444
let err = format!("{:?} not supported, expects 'ws' or 'wss'", invalid_scheme);
#[cfg(not(feature = "tls"))]
let err = "URL scheme not supported, expects 'ws'";
let err = format!("{:?} not supported, expects 'ws' ('wss' requires the tls feature)", invalid_scheme);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will print something like Some("http") not supported, expects 'ws' or 'wss'; are we happy with that or would it be better to maybe do something like invalid_scheme.unwrap_or("no scheme")?

Copy link
Member Author

@niklasad1 niklasad1 Jan 6, 2022

Choose a reason for hiding this comment

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

Right, I think your suggestion is better.

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

LGTM; minor question on error message format!

@niklasad1 niklasad1 merged commit 3749ae2 into master Jan 6, 2022
@niklasad1 niklasad1 deleted the na-ws-client-fix-error-msg branch January 6, 2022 12:38
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.

3 participants