From 8b132354bb7b08e96bb19b8446f1456c4013e842 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 5 Nov 2018 14:22:39 +0300 Subject: don't send backtraces for canceled requests --- crates/ra_lsp_server/src/main_loop/mod.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'crates/ra_lsp_server/src/main_loop/mod.rs') diff --git a/crates/ra_lsp_server/src/main_loop/mod.rs b/crates/ra_lsp_server/src/main_loop/mod.rs index 1eb147539..229d1b0f7 100644 --- a/crates/ra_lsp_server/src/main_loop/mod.rs +++ b/crates/ra_lsp_server/src/main_loop/mod.rs @@ -376,11 +376,21 @@ impl<'a> PoolDispatcher<'a> { Ok(lsp_error) => { RawResponse::err(id, lsp_error.code, lsp_error.message) } - Err(e) => RawResponse::err( - id, - ErrorCode::InternalError as i32, - format!("{}\n{}", e, e.backtrace()), - ), + Err(e) => { + if is_canceled(&e) { + RawResponse::err( + id, + ErrorCode::RequestCancelled as i32, + e.to_string(), + ) + } else { + RawResponse::err( + id, + ErrorCode::InternalError as i32, + format!("{}\n{}", e, e.backtrace()), + ) + } + } }, }; let task = Task::Respond(resp); -- cgit v1.2.3