From d9456c3989bf1988e266b22e76a995b20eae7ae4 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sat, 26 Jan 2019 20:43:51 +0000 Subject: Return an lsp error --- crates/ra_lsp_server/src/main_loop/handlers.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crates') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 3f58e3c93..4fc15c796 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -537,13 +537,16 @@ pub fn handle_formatting( let output = rustfmt.wait_with_output()?; let captured_stdout = String::from_utf8(output.stdout)?; if !output.status.success() { - failure::bail!( - r#"rustfmt exited with: + return Err(LspError::new( + gen_lsp_server::ErrorCode::ParseError as i32, + format!( + r#"rustfmt exited with: Status: {} stdout: {}"#, - output.status, - captured_stdout, - ); + output.status, captured_stdout, + ), + ) + .into()); } Ok(Some(vec![TextEdit { -- cgit v1.2.3