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