Skip to content

Commit

Permalink
Mention that Error is required for cause()
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 25, 2017
1 parent 5b64a7b commit 3bb4d58
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/interoperability.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,12 @@ fn test_sync() {
An error type is any type `E` used in a `Result<T, E>` returned by any public
function of your crate. Error types should always implement the
[`std::error::Error`] trait which is the mechanism by which error handling
libraries like [`error-chain`] abstract over different types of errors.
libraries like [`error-chain`] abstract over different types of errors, and
which allows the error to be used as the [`cause()`] of another error.

[`std::error::Error`]: https://doc.rust-lang.org/std/error/trait.Error.html
[`error-chain`]: https://docs.rs/error-chain
[`cause()`]: https://doc.rust-lang.org/std/error/trait.Error.html#method.cause

Additionally, error types should implement the [`Send`] and [`Sync`] traits. An
error that is not `Send` cannot be returned by a thread run with
Expand Down

0 comments on commit 3bb4d58

Please sign in to comment.