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

Fix version issues #275

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ default = ["backtrace", "example_generated"]
example_generated = []

[dependencies]
backtrace = { version = "0.3.3", optional = true }
# https://github.com/rust-lang/backtrace-rs/commit/17db3f34b1e674b2a653f4a4399750e25f657eea in backtrace-rs 0.3.36
# breaks 1.31.0 because of issues with "mod print"
backtrace = { version = "0.3.3,<0.3.36", optional = true }
# For later rust try! compatibility
try = "1.0"

[build-dependencies]
version_check = "0.9"
11 changes: 7 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,9 @@ pub use backtrace::Backtrace;
#[doc(hidden)]
pub use backtrace::InternalBacktrace;

#[macro_use]
extern crate try;

#[derive(Debug)]
#[allow(unknown_lints, bare_trait_objects)]
/// Iterator over the error chain using the `Error::cause()` method.
Expand Down Expand Up @@ -648,14 +651,14 @@ impl<'a, T> fmt::Display for DisplayChain<'a, T>
{
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
// Keep `try!` for 1.10 support
writeln!(fmt, "Error: {}", self.0)?;
try!(writeln!(fmt, "Error: {}", self.0));

for e in self.0.iter().skip(1) {
writeln!(fmt, "Caused by: {}", e)?;
try!(writeln!(fmt, "Caused by: {}", e));
}

if let Some(backtrace) = self.0.backtrace() {
writeln!(fmt, "{:?}", backtrace)?;
if let Some(backtrace) = ChainedError::backtrace(self.0) {
try!(writeln!(fmt, "{:?}", backtrace));
}

Ok(())
Expand Down