6094: More panic_context r=matklad a=matklad

bors r+\n🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-09-29 18:50:46 +00:00 committed by GitHub
commit 7283783b98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@ impl<'a> RequestDispatcher<'a> {
) -> Result<&mut Self> ) -> Result<&mut Self>
where where
R: lsp_types::request::Request + 'static, R: lsp_types::request::Request + 'static,
R::Params: DeserializeOwned + panic::UnwindSafe + 'static, R::Params: DeserializeOwned + panic::UnwindSafe + fmt::Debug + 'static,
R::Result: Serialize + 'static, R::Result: Serialize + 'static,
{ {
let (id, params) = match self.parse::<R>() { let (id, params) = match self.parse::<R>() {
@ -34,6 +34,7 @@ impl<'a> RequestDispatcher<'a> {
}; };
let world = panic::AssertUnwindSafe(&mut *self.global_state); let world = panic::AssertUnwindSafe(&mut *self.global_state);
let response = panic::catch_unwind(move || { let response = panic::catch_unwind(move || {
stdx::panic_context::enter(format!("request: {} {:#?}", R::METHOD, params));
let result = f(world.0, params); let result = f(world.0, params);
result_to_response::<R>(id, result) result_to_response::<R>(id, result)
}) })
@ -159,6 +160,7 @@ impl<'a> NotificationDispatcher<'a> {
return Ok(self); return Ok(self);
} }
}; };
stdx::panic_context::enter(format!("notification: {}", N::METHOD));
f(self.global_state, params)?; f(self.global_state, params)?;
Ok(self) Ok(self)
} }