Return an lsp error

This commit is contained in:
DJMcNab 2019-01-26 20:43:51 +00:00
parent 632b0f2902
commit d9456c3989

View file

@ -537,13 +537,16 @@ pub fn handle_formatting(
let output = rustfmt.wait_with_output()?; let output = rustfmt.wait_with_output()?;
let captured_stdout = String::from_utf8(output.stdout)?; let captured_stdout = String::from_utf8(output.stdout)?;
if !output.status.success() { if !output.status.success() {
failure::bail!( return Err(LspError::new(
r#"rustfmt exited with: gen_lsp_server::ErrorCode::ParseError as i32,
format!(
r#"rustfmt exited with:
Status: {} Status: {}
stdout: {}"#, stdout: {}"#,
output.status, output.status, captured_stdout,
captured_stdout, ),
); )
.into());
} }
Ok(Some(vec![TextEdit { Ok(Some(vec![TextEdit {