More panic_context

This commit is contained in:
Aleksey Kladov 2020-09-29 20:46:36 +02:00
parent d3a2b21a8c
commit 8e34c0fb73

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)
}