where T: Encodable
{
match result {
- Err(e) => handle_error(e, shell),
+ Err(e) => handle_cli_error(e, shell),
Ok(Some(encodable)) => {
let encoded = json::encode(&encodable).unwrap();
println!("{}", encoded);
}
}
-pub fn handle_error(err: CliError, shell: &mut MultiShell) {
- debug!("handle_error; err={:?}", err);
+pub fn handle_cli_error(err: CliError, shell: &mut MultiShell) {
+ debug!("handle_cli_error; err={:?}", err);
let CliError { error, exit_code, unknown } = err;
// exit_code == 0 is non-fatal error, e.g. docopt version info
std::process::exit(exit_code);
}
+pub fn handle_error(err: &CargoError, shell: &mut MultiShell) {
+ debug!("handle_error; err={:?}", err);
+
+ let _ignored_result = shell.error(err);
+ handle_cause(err, shell);
+}
+
fn handle_cause(mut cargo_err: &CargoError, shell: &mut MultiShell) -> bool {
let verbose = shell.get_verbose();
let mut err;
fn print(error: String, shell: &mut MultiShell) {
let _ = shell.err().say("\nCaused by:", BLACK);
- let _ = shell.err().say(format!(" {}", error), BLACK);
+ let _ = shell.err().say(format!(" {}\n", error), BLACK);
}
}
use core::{PackageId, Target, Profile};
use util::{Config, DependencyQueue, Fresh, Dirty, Freshness};
use util::{CargoResult, ProcessBuilder, profile, internal, human};
+use {handle_error};
use super::{Context, Kind, Unit};
use super::job::Job;
match result {
Ok(()) => self.finish(key, cx)?,
Err(e) => {
- cx.config.shell().error(format!("{}", e))?;
+ handle_error(&*e, &mut *cx.config.shell());
+
if self.active > 0 {
cx.config.shell().say(
"Build failed, waiting for other \