mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
improvement: make diagnostics for flags involving byte count parsing actually good
This adds an error type called `ByteCountParseError` with a vanilla `std::error::Error` implementation. The code could be significantly compressed with a dependency like `thiserror`. I opted to implement a separate error type for `parse_byte_count` rather than using `anyhow`'s small ecosystem of error types there (though they are used in `<binary>::run`) because it allows pairing diagnostic results with tests, incl. those already written. This can be helpful in preventing regressions in error diagnostics.
This commit is contained in:
1 parent
e0da7b3f82
commit
13aec946a3
3 files changed
+217
-66
No files matched your search
@@ -15,6 +15,7 @@ ansi_term = "0.12"
|
||||
anyhow = "1.0.31"
|
||||
atty = "0.2"
|
||||
libc = "0.2"
|
||||
thiserror = "1.0.19"
|
||||
|
||||
[dependencies.clap]
|
||||
version = "2"
|
||||
|
||||
Reference in new issue
Block a user