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 serde::Deserialize impl for Url prints confusing error message #861

Open
justy777 opened this issue Jul 23, 2023 · 0 comments · May be fixed by #862
Open

Fix serde::Deserialize impl for Url prints confusing error message #861

justy777 opened this issue Jul 23, 2023 · 0 comments · May be fixed by #862

Comments

@justy777
Copy link

justy777 commented Jul 23, 2023

When failing to deserialize a str into a Url the current implementation of Deserialize returns an error with a confusing message.

For example:

use serde_json::{json, Result};
use url::Url;

let json = json!("bad_url");
let result: Result<Url> = serde_json::from_value(json);
println!("{}", result.err().unwrap());

Actual: invalid value: string "bad_url", expected relative URL without a base
Expected: invalid value: string "bad_url", expected a string representing a URL

justy777 added a commit to justy777/rust-url that referenced this issue Jul 23, 2023
justy777 added a commit to justy777/rust-url that referenced this issue Oct 4, 2023
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 a pull request may close this issue.

1 participant