Commit Graph
26 Commits
Author SHA1 Message Date
Erich Gubler 13aec946a3 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.
2020-06-17 18:05:42 +02:00
Erich Gubler 2bdf5d768f feat: use anyhow for more structured error messages and better error reporting flexibility
This significantly changes the structure of potential output of
top-level errors.  Before, errors that have a `source` were printed on a
single line, with the `source` omitted. Now, an error with a `source`
will be printed like:

```
Error: <`Display` impl of error>

Caused by:
    <`Display` impl of `source` error>
```

If there are multiple `source` errors in a chain, then it will be of the
form:

```
Error: <`Display` impl of error>

Caused by:
    0: <`Display` impl of first `source` error>
    1: <`Display` impl of `source` of `source` error>
    # etc.
```

Now, in practice this never happened before, since the only error
type that ever could return from `<binary>::run` was `std::io::Error`,
which has no `source`. However, `source`s can start being added if, say,
future work involved using `anyhow::Context::context` or custom errors
that implement `std::Error::source` are added to the codebase. I believe
this is a good choice going forward, but I definitely want to foster
discussion and acceptance for it in the open first!
2020-06-17 18:05:42 +02:00
sharkdp a7892881f3 Wrap help text at 90 characters 2020-06-08 23:19:56 +02:00
sharkdp 478cc25ffd Bump version to 0.8.0 2020-06-07 15:12:35 +02:00
sharkdp b1c4b0bf2b Update dependencies 2020-06-07 15:12:35 +02:00
Mario Reder 5327b71215 fix review comments 2020-05-13 18:55:24 +02:00
sharkdp 2bda250906 Bump version 2020-03-09 20:41:00 +01:00
sharkdp f32431e552 Update dependencies 2020-03-09 20:33:08 +01:00
sharkdp f71ad1e00d Remove Ctrl-C handler, fixes #84 2020-03-09 20:20:12 +01:00
sharkdp c75a882081 Update dependencies 2019-10-08 20:32:56 +02:00
sharkdp 81787d0858 Bump version 2019-10-08 20:31:56 +02:00
sharkdp 82c34fe39b Bump version 2019-05-30 15:35:21 +02:00
sharkdp 17c2c61bad Update dependencies, closes #61 2019-05-28 21:37:33 +02:00
sharkdp 2ad15413b9 Bump version 2019-04-13 18:39:34 +02:00
sharkdp 710c86f6a1 Update dependencies 2019-04-13 18:38:50 +02:00
Mikaela Szekely 6a848b14f8 Allow passing length in hex with 0x notation 2019-03-09 07:41:52 +01:00
sharkdp 7e46a5d788 Bump version 2019-01-14 10:51:32 +01:00
sharkdp 19030470f9 Add proper Ctrl-C handling 2019-01-14 10:40:04 +01:00
sharkdp f6f41e76aa Use --color=always/auto/never instead of --no-color 2019-01-14 09:14:47 +01:00
sharkdp 0dad8bf481 Bump version 2019-01-10 08:36:45 +01:00
sharkdp 612a227a81 Update dependencies 2019-01-10 08:34:28 +01:00
sharkdp a109ce7aba Bump version 2018-12-30 12:56:20 +01:00
sharkdp ba5f800265 Update Cargo.lock 2018-11-06 21:28:13 +01:00
sharkdp 1a88fd5f38 Bump version 2018-11-06 21:23:51 +01:00
sharkdp e4e6c6b323 Colors! 2018-11-05 22:40:43 +01:00
sharkdp abd52ce7de Initial working version of a hex viewer 2018-11-05 21:30:39 +01:00