diff options
author | Edwin Cheng <[email protected]> | 2020-04-23 18:38:58 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-04-23 18:38:58 +0100 |
commit | 1627b55028a5e9a4fccad6124bef602d1b55b28b (patch) | |
tree | 137c74ad0827cab0e13c2e890d34eb17a08c4bc6 /crates/ra_proc_macro_srv/src | |
parent | 25e8f5ded9037bd9a172861c995b467b63390808 (diff) |
Bubble up error
Diffstat (limited to 'crates/ra_proc_macro_srv/src')
-rw-r--r-- | crates/ra_proc_macro_srv/src/cli.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/ra_proc_macro_srv/src/cli.rs b/crates/ra_proc_macro_srv/src/cli.rs index c7f41e448..ded1bcdbc 100644 --- a/crates/ra_proc_macro_srv/src/cli.rs +++ b/crates/ra_proc_macro_srv/src/cli.rs | |||
@@ -4,16 +4,13 @@ use crate::{expand_task, list_macros}; | |||
4 | use ra_proc_macro::msg::{self, Message}; | 4 | use ra_proc_macro::msg::{self, Message}; |
5 | use std::io; | 5 | use std::io; |
6 | 6 | ||
7 | pub fn run() { | 7 | pub fn run() -> io::Result<()> { |
8 | loop { | 8 | loop { |
9 | let req = match read_request() { | 9 | // bubble up the error for read request, |
10 | Err(err) => { | 10 | // as the stdin pipe may be closed. |
11 | // Panic here, as the stdin pipe may be closed. | 11 | let req = match read_request()? { |
12 | // Otherwise, client will be restarted the service anyway. | 12 | None => continue, |
13 | panic!("Read message error on ra_proc_macro_srv: {}", err); | 13 | Some(req) => req, |
14 | } | ||
15 | Ok(None) => continue, | ||
16 | Ok(Some(req)) => req, | ||
17 | }; | 14 | }; |
18 | 15 | ||
19 | let res = match req { | 16 | let res = match req { |