You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I discussed the logic here andrewhickman#59 (comment).
The prior suggested name "anyhow" was a little too specific/esoteric and in the event that the feature flag outlives the popularity of `anyhow` it wouldn't make sense.
This suggested name tries to focus on the behavior outcome of the feature. It empowers callers to format the "called by" information however they want by:
- Providing a source of that data (Error::source)
- Not formatting emitting that data in `Display`
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# fs-err Changelog
2
2
3
-
* Change errors to output original `std::io::Error` information Display by default. This functionality can be disabled for [anyhow](https://docs.rs/anyhow/latest/anyhow/) users by using the new feature `anyhow` ([#60](https://github.com/andrewhickman/fs-err/pull/60)).
3
+
* Change errors to output original `std::io::Error` information Display by default. This functionality can be disabled for [anyhow](https://docs.rs/anyhow/latest/anyhow/) users by using the new feature `custom_caused_by` ([#60](https://github.com/andrewhickman/fs-err/pull/60)).
Copy file name to clipboardExpand all lines: src/lib.rs
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,8 @@ failed to open file `does not exist.txt`
26
26
caused by: The system cannot find the file specified. (os error 2)
27
27
```
28
28
29
-
> Note: To bypass displaying the original error message you can enable the `anyhow` feature.
30
-
> When the `anyhow` feature is enabled `Error::source()` will return `Some` and the original
31
-
> error will not be `Display`-ed via fs-err.
29
+
> Note: Users of `anyhow` or other libraries that format an Error's sources can enable the `custom_caused_by` feature to control the formatting of the orginal error message.
30
+
> When enabled, the `std::fmt::Display` implementation will emit the failed operation and paths but not the original `std::io::Error`. It will instead provide access via [Error::source](https://doc.rust-lang.org/std/error/trait.Error.html#method.source), which will be used by `anyhow` (or similar) libraries.
0 commit comments