Print error cause chain on failures in build.rs

This commit is contained in:
David Tolnay 2020-01-26 14:15:59 -08:00
parent 152119246e
commit 366ef8b486
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -370,6 +370,7 @@ pub mod private {
}
use crate::error::Result;
use anyhow::anyhow;
use std::fs;
use std::io::{self, Write};
use std::path::Path;
@ -442,7 +443,7 @@ impl Build {
match try_generate_bridge(rust_source_file.as_ref()) {
Ok(build) => build,
Err(err) => {
let _ = writeln!(io::stderr(), "\n\ncxxbridge error: {}\n\n", err);
let _ = writeln!(io::stderr(), "\n\ncxxbridge error: {:?}\n\n", anyhow!(err));
process::exit(1);
}
}