]> git.lizzy.rs Git - rust.git/commitdiff
Return an lsp error
authorDJMcNab <36049421+DJMcNab@users.noreply.github.com>
Sat, 26 Jan 2019 20:43:51 +0000 (20:43 +0000)
committerDJMcNab <36049421+DJMcNab@users.noreply.github.com>
Sat, 26 Jan 2019 20:43:51 +0000 (20:43 +0000)
crates/ra_lsp_server/src/main_loop/handlers.rs

index 3f58e3c93e8aa20aa2ffd5552f512d08dbef45d1..4fc15c796262883fc01acdcac0dc0e2ca51e562e 100644 (file)
@@ -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 {