Skip to content

Instantly share code, notes, and snippets.

@tailhook
Created June 16, 2016 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tailhook/bc08bf26f601d9795c983daec86ea76b to your computer and use it in GitHub Desktop.
Save tailhook/bc08bf26f601d9795c983daec86ea76b to your computer and use it in GitHub Desktop.
--- 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