servo / rust-url

URL parser for Rust
https://docs.rs/url/
Apache License 2.0
1.31k stars 325 forks source link

IDNA: Errors - Allow people to get specific error in basic values #794

Open Arisa-Snowbell opened 2 years ago

Arisa-Snowbell commented 2 years ago

When for example I wanted to figure out whats wrong with the unicode string I tried to convert to ASCII I could before this get only string from of it becuase of the implemented Debug for Errors struct but thats very inconvinient trying to parse a string where there is the possibility of accessing the basic values themselves. This commit allows people to actually get the basic values and based on that decide what to do next in their code.

codecov-commenter commented 2 years ago

Codecov Report

Base: 85.31% // Head: 85.31% // No change to project coverage :thumbsup:

Coverage data is based on head (99326c5) compared to base (359bc90). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #794 +/- ## ======================================= Coverage 85.31% 85.31% ======================================= Files 22 22 Lines 3915 3915 ======================================= Hits 3340 3340 Misses 575 575 ``` | [Impacted Files](https://codecov.io/gh/servo/rust-url/pull/794?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Servo) | Coverage Δ | | |---|---|---| | [idna/src/uts46.rs](https://codecov.io/gh/servo/rust-url/pull/794/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Servo#diff-aWRuYS9zcmMvdXRzNDYucnM=) | `94.31% <ø> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Servo). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Servo)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

hsivonen commented 3 months ago

This commit allows people to actually get the basic values and based on that decide what to do next in their code.

What's the use case for this?

In idna 1.0, I removed all these error categorization fields, but there's an option to have each error flagged by a REPLACEMENT CHARACTER in the ToUnicode output, which can indicate to the end user where the errors were.