Add panic_context module for better panic messages
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//! A visitor for downcasting arbitrary request (JSON) into a specific type.
|
||||
use std::panic;
|
||||
use std::{fmt, panic};
|
||||
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
|
||||
@@ -49,7 +49,7 @@ impl<'a> RequestDispatcher<'a> {
|
||||
) -> Result<&mut Self>
|
||||
where
|
||||
R: lsp_types::request::Request + 'static,
|
||||
R::Params: DeserializeOwned + Send + 'static,
|
||||
R::Params: DeserializeOwned + Send + fmt::Debug + 'static,
|
||||
R::Result: Serialize + 'static,
|
||||
{
|
||||
let (id, params) = match self.parse::<R>() {
|
||||
@@ -61,7 +61,10 @@ impl<'a> RequestDispatcher<'a> {
|
||||
|
||||
self.global_state.task_pool.handle.spawn({
|
||||
let world = self.global_state.snapshot();
|
||||
|
||||
move || {
|
||||
let _ctx =
|
||||
stdx::panic_context::enter(format!("request: {} {:#?}", R::METHOD, params));
|
||||
let result = f(world, params);
|
||||
Task::Response(result_to_response::<R>(id, result))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user