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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

justy777
Copy link

Fixes #861

@denschub
Copy link

denschub commented May 31, 2024

I think a better implementation would be

E::invalid_value(Unexpected::Other(&err_s), &self)

which then would keep the original "why it's broken" info intact:

    TOML parse error at line 2, column 12
      |
    2 | root_url = "http://[::1]:123456"
      |            ^^^^^^^^^^^^^^^^^^^^^
    invalid value: invalid port number, expected a string representing an URL

or even simpler:

Url::parse(s).map_err(E::custom)?;

which still would be fine:

    TOML parse error at line 2, column 12
      |
    2 | root_url = "http://localhost:8042111/blah"
      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    invalid port number

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.

Fix serde::Deserialize impl for Url prints confusing error message
2 participants