Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit 8ea2d4f

Browse files
ahmedcharlesYamakaky
authored andcommitted
Implement Debug for ErrorChainIter
Fixes #169.
1 parent 8cb6044 commit 8ea2d4f

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Unreleased
22

3-
- [Rename `ChanedError::display` to `display_chain`](https://github.com/brson/error-chain/issues/180)
3+
- [Implement `Debug` for `ErrorChainIter`](https://github.com/brson/error-chain/issues/169)
4+
- [Rename `ChainedError::display` to `display_chain`](https://github.com/brson/error-chain/issues/180)
45
- [Add a new method for `Error`: `chain_err`.](https://github.com/brson/error-chain/pull/141)
56
- [Allow `chain_err` to be used on `Option<T>`](https://github.com/brson/error-chain/pull/156)
67
- [Add support for creating an error chain on boxed trait errors (`Box<Error>`)](https://github.com/brson/error-chain/pull/156)

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ pub use quick_main::ExitCode;
493493
#[cfg(feature = "example_generated")]
494494
pub mod example_generated;
495495

496+
#[derive(Debug)]
496497
/// Iterator over the error chain using the `Error::cause()` method.
497498
pub struct ErrorChainIter<'a>(pub Option<&'a error::Error>);
498499

tests/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ mod foreign_link_test {
358358
fn iterates() {
359359
let chained_error = try_foreign_error().err().unwrap();
360360
let mut error_iter = chained_error.iter();
361+
assert!(!format!("{:?}", error_iter).is_empty());
361362
assert_eq!(format!("{}", ForeignError { cause: ForeignErrorCause {} }),
362363
format!("{}", error_iter.next().unwrap()));
363364
assert_eq!(format!("{}", ForeignErrorCause {}),

0 commit comments

Comments
 (0)