Skip to content

Commit 1627b55

Browse files
committed
Bubble up error
1 parent 25e8f5d commit 1627b55

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

crates/ra_proc_macro_srv/src/cli.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ use crate::{expand_task, list_macros};
44
use ra_proc_macro::msg::{self, Message};
55
use std::io;
66

7-
pub fn run() {
7+
pub fn run() -> io::Result<()> {
88
loop {
9-
let req = match read_request() {
10-
Err(err) => {
11-
// Panic here, as the stdin pipe may be closed.
12-
// Otherwise, client will be restarted the service anyway.
13-
panic!("Read message error on ra_proc_macro_srv: {}", err);
14-
}
15-
Ok(None) => continue,
16-
Ok(Some(req)) => req,
9+
// bubble up the error for read request,
10+
// as the stdin pipe may be closed.
11+
let req = match read_request()? {
12+
None => continue,
13+
Some(req) => req,
1714
};
1815

1916
let res = match req {

crates/rust-analyzer/src/bin/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn setup_logging() -> Result<()> {
6666
}
6767

6868
fn run_proc_macro_srv() -> Result<()> {
69-
ra_proc_macro_srv::cli::run();
69+
ra_proc_macro_srv::cli::run()?;
7070
Ok(())
7171
}
7272

0 commit comments

Comments
 (0)