Created
June 16, 2016 22:04
-
-
Save tailhook/bc08bf26f601d9795c983daec86ea76b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- examples/context.rs 2016-06-17 00:55:28.578244188 +0300 | |
+++ examples/backtrace.rs 2016-06-17 00:59:10.613723109 +0300 | |
@@ -1,4 +1,5 @@ | |
#[macro_use(quick_error)] extern crate quick_error; | |
+extern crate backtrace; | |
use std::io::{self, stderr, Read, Write}; | |
use std::fs::File; | |
@@ -7,6 +8,7 @@ | |
use std::path::{Path, PathBuf}; | |
use quick_error::ResultExt; | |
+use backtrace::Backtrace; | |
quick_error! { | |
#[derive(Debug)] | |
@@ -14,10 +16,10 @@ | |
NoFileName { | |
description("no file name specified") | |
} | |
- Io(err: io::Error, path: PathBuf) { | |
- display("could not read file {:?}: {}", path, err) | |
+ Io(err: io::Error, path: PathBuf, tb: Backtrace) { | |
+ display("could not read file {:?}: {}\n{:?}", path, err, tb) | |
context(path: &'a Path, err: io::Error) | |
- -> (err, path.to_path_buf()) | |
+ -> (err, path.to_path_buf(), Backtrace::new()) | |
} | |
Parse(err: ParseIntError, path: PathBuf) { | |
display("could not parse file {:?}: {}", path, err) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment