backtrace
This commit is contained in:
parent
fa477593fa
commit
28c779c843
|
@ -1,3 +1,4 @@
|
|||
#![feature(backtrace)]
|
||||
extern crate hptp;
|
||||
extern crate tokio;
|
||||
#[macro_use]
|
||||
|
@ -9,8 +10,12 @@ use tokio::net::UdpSocket;
|
|||
|
||||
#[derive(Error, Debug)]
|
||||
enum Error {
|
||||
#[error("io error: {0}")]
|
||||
Io(#[from] tokio::io::Error),
|
||||
#[error("io error: {source}")]
|
||||
Io {
|
||||
#[from]
|
||||
source: tokio::io::Error,
|
||||
backtrace: std::backtrace::Backtrace,
|
||||
},
|
||||
#[error("no UDP port available for listening")]
|
||||
NoPortAvail,
|
||||
}
|
||||
|
@ -23,7 +28,11 @@ fn entry() -> Result<(), Error> {
|
|||
|
||||
fn main() {
|
||||
if let Err(e) = entry() {
|
||||
println!("ERROR: {}", e);
|
||||
use std::error::Error;
|
||||
println!("Error: {}", e);
|
||||
for bt in e.backtrace() {
|
||||
println!("{}", bt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue