Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
debugger: Fix panic when handling invalid `RunInTerminal` request (#32500)
Anthony Eid5eb68f0ea453
diff --git a/Cargo.lock b/Cargo.lockindex 288952d7700..d28709884ad 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -4050,7 +4050,7 @@ dependencies = [[[package]]name = "dap-types"version = "0.0.1"-source = "git+https://github.com/zed-industries/dap-types?rev=68516de327fa1be15214133a0a2e52a12982ce75#68516de327fa1be15214133a0a2e52a12982ce75"+source = "git+https://github.com/zed-industries/dap-types?rev=cef124a5109d6fd44a3f986882d78ce40b8d4fb5#cef124a5109d6fd44a3f986882d78ce40b8d4fb5"dependencies = ["schemars","serde",diff --git a/Cargo.toml b/Cargo.tomlindex 39d15f8c1e7..5d866ee19f4 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -435,7 +435,7 @@ core-foundation-sys = "0.8.6"core-video = { version = "0.4.3", features = ["metal"] }criterion = { version = "0.5", features = ["html_reports"] }ctor = "0.4.0"-dap-types = { git = "https://github.com/zed-industries/dap-types", rev = "68516de327fa1be15214133a0a2e52a12982ce75" }+dap-types = { git = "https://github.com/zed-industries/dap-types", rev = "cef124a5109d6fd44a3f986882d78ce40b8d4fb5" }dashmap = "6.0"derive_more = "0.99.17"dirs = "4.0"diff --git a/crates/project/src/debugger/session.rs b/crates/project/src/debugger/session.rsindex 763bc1c863f..05c83195ed7 100644--- a/crates/project/src/debugger/session.rs+++ b/crates/project/src/debugger/session.rs@@ -1008,10 +1008,41 @@ impl Session {request: dap::messages::Request,cx: &mut Context<Self>,) -> Task<Result<()>> {- let request_args = serde_json::from_value::<RunInTerminalRequestArguments>(+ let request_args = match serde_json::from_value::<RunInTerminalRequestArguments>(request.arguments.unwrap_or_default(),- )- .expect("To parse StartDebuggingRequestArguments");+ ) {+ Ok(args) => args,+ Err(error) => {+ return cx.spawn(async move |session, cx| {+ let error = serde_json::to_value(dap::ErrorResponse {+ error: Some(dap::Message {+ id: request.seq,+ format: error.to_string(),+ variables: None,+ send_telemetry: None,+ show_user: None,+ url: None,+ url_label: None,+ }),+ })+ .ok();++ session+ .update(cx, |this, cx| {+ this.respond_to_client(+ request.seq,+ false,+ StartDebugging::COMMAND.to_string(),+ error,+ cx,+ )+ })?+ .await?;++ Err(anyhow!("Failed to parse RunInTerminalRequestArguments"))+ });+ }+ };let seq = request.seq;