Commit graph

51 commits

Author SHA1 Message Date
Harald Hoyer 46b7f58e72
feat: add annotate() method to Context
to just annotate the passed error with location data

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-28 17:06:10 +02:00
Harald Hoyer 101d2074e1
feat: removed prelude
It was causing the rust compiler to output the renamed structs in error
messages confusing users who don't know about the old renamed ones.

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-28 17:04:39 +02:00
Harald Hoyer aaca6945b0
feat: add new(Into<String>) method for str_context! types
Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-28 16:32:46 +02:00
Harald Hoyer 3ab04cca25
feat: cleanup names
- ResultTrait -> Context
- ChainErrorDown -> ErrorDown
- derive_err_kind -> err_kind
- derive_str_context -> str_context
- add `prelude::v2` with only the traits

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-28 16:18:54 +02:00
Harald Hoyer cb2e1509e5
chore: remove more Chain.. occurences
Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-28 15:28:27 +02:00
Harald Hoyer a116310c4d
doc: improvements
- remove `Chain…` mentions in the docs
- add doc links
- add rustdoc feature to scrape the examples for code

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-28 15:06:31 +02:00
Harald Hoyer cf62d1a9f9
chore: remove need for cargo readme
Just use `#![doc = include_str!("../README.md")]`

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-27 14:59:05 +02:00
Harald Hoyer 1327575aa9
feat!: remove Chain prefix from Error and Result
like `anyhow`

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-27 14:36:52 +02:00
Harald Hoyer f5c8afce0d
feat: remove ChainErrorFrom and IntoChainError, add From
ChainErrorFrom and IntoChainError are not needed anymore with the
`#[track_caller]` feature.

Now, a proper `From<T> for ChainError<T>` can be implemented.
2023-07-27 14:32:30 +02:00
Harald Hoyer bdfec08228
feat: add inline to context and map_context methods 2023-07-27 14:32:26 +02:00
Harald Hoyer 4eae3da3c1
feat: removed feature display-cause
`display-cause` can be turned on with the `{:#}` format specifier
2023-07-27 14:32:21 +02:00
Harald Hoyer 95c5a02d50
test: rewrite doc test
Line numbering has changed in Rust 1.71 in the doc tests, due to an
extra inserted `#[allow(unused_extern_crates)]` line.

Don't test for the exact line number anymore.

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-27 14:04:02 +02:00
Harald Hoyer d60cdf9cdb
fix: clippy
Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2023-07-27 14:03:12 +02:00
Jakub Duchniewicz 259712931f Rust PR 75180 fix. 2021-02-01 16:51:34 +01:00
Harald Hoyer f586b52675
Better introduction examples. 2020-09-01 22:55:29 +02:00
Harald Hoyer 14c67e1903
ignore first example 2020-09-01 21:42:17 +02:00
Harald Hoyer 1654624c08
more documentation and formatting 2020-09-01 21:34:46 +02:00
Harald Hoyer ed710fada3 rename cherr() to context() 2020-09-01 21:03:57 +02:00
Harald Hoyer 2af5fb7ad6
doc fix 2020-08-28 17:11:56 +02:00
Harald Hoyer 356335e807
use #[track_caller] and Location 2020-08-28 16:58:58 +02:00
Harald Hoyer 935eb658cf
make test pass with --all-features 2020-06-03 14:42:24 +02:00
Harald Hoyer 241502de75
remove main in doc tests and cargo fmt the doc tests 2020-06-03 14:19:48 +02:00
Harald Hoyer 1d43a39c61
add dyn 2020-03-03 15:06:44 +01:00
Harald Hoyer ae6c01aab2
macro hygiene 2019-03-13 11:34:53 +01:00
Harald Hoyer a558c35ba4
make ChainError Send + Sync 2019-03-12 16:44:51 +01:00
Harald Hoyer 51af6da378
add derive_err_kind() and more docs 2019-03-07 17:03:35 +01:00
Harald Hoyer c014f1a922
cargo fmt and doc format 2019-03-06 08:58:15 +01:00
Harald Hoyer 490eaa474b
deny more lints and add more docs 2019-03-05 18:00:49 +01:00
Harald Hoyer 15f983ce55 doc spelling 2019-03-05 13:28:53 +01:00
Harald Hoyer 8bd4ffca56
simplify macros 2019-03-04 11:44:07 +01:00
Harald Hoyer 2f8c68b36d cargo fmt 2019-02-07 08:58:18 +01:00
Harald Hoyer f5457a2a51 add more docs 2019-02-07 08:58:05 +01:00
Harald Hoyer 4762a75cfe impl Deref for ChainError 2019-02-01 11:40:46 +01:00
Harald Hoyer ef7edb1061 Use line comments instead of block comments 2019-02-01 10:17:49 +01:00
Harald Hoyer 694cb4f273 add find_chain_or_cause() 2019-01-26 10:44:25 +01:00
Harald Hoyer e7d4afb86c fixed filter() and filter_map() calls 2019-01-26 10:23:00 +01:00
Harald Hoyer d14af67560 add ChainError Iterator 2019-01-25 13:53:30 +01:00
Harald Hoyer a869a2e3ea more idiomatic 2019-01-15 09:17:58 +01:00
Harald Hoyer 6ad9497512 extend cherr! macro 2019-01-09 13:23:14 +01:00
Harald Hoyer 7003baaaec refine macros 2019-01-09 11:46:19 +01:00
Harald Hoyer 3bf7fa00fb fix tests for windows 2019-01-08 16:20:36 +01:00
Harald Hoyer a040044529 add more traits and macros
Namely:
* ChainErrorFrom
* IntoChainError
* minto_cherr!
* into_cherr!
* strerr!

Also make derive_str_cherr! struct public
2019-01-08 15:33:12 +01:00
Harald Hoyer bbc9c12164 more documentation 2018-12-21 14:06:28 +01:00
Harald Hoyer 8ad6eaceac lots of documentation 2018-12-21 13:50:08 +01:00
Harald Hoyer 88660684b7 add mdbook 2018-12-20 14:52:06 +01:00
Harald Hoyer 46e2c78aa8 add tutorial 2018-12-20 10:09:12 +01:00
Harald Hoyer d1295092a4 factor out example 2018-12-19 17:01:01 +01:00
Harald Hoyer 59066788b4 next take 2018-12-19 16:31:59 +01:00
Harald Hoyer e4c34740be ii 2018-12-18 19:04:02 +01:00
Harald Hoyer 8017b6cdfd refactor 2018-12-18 16:21:45 +01:00