From 444f7978271b210997f33c06214e06e7956b5f79 Mon Sep 17 00:00:00 2001 From: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> Date: Tue, 10 Jun 2025 21:13:27 -0400 Subject: [PATCH] debugger beta: Improve resolve debug scenario error message (#32504) When no locator or valid config is found we expose the invalid config error message to the user now. Closes #32067 Release Notes: - debugger beta: Improve error message when starting a debugger session with an invalid configuration --- crates/debugger_ui/src/session/running.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/debugger_ui/src/session/running.rs b/crates/debugger_ui/src/session/running.rs index 4281e09bf4..90f725f869 100644 --- a/crates/debugger_ui/src/session/running.rs +++ b/crates/debugger_ui/src/session/running.rs @@ -818,7 +818,7 @@ impl RunningState { let request_type = dap_registry .adapter(&adapter) - .ok_or_else(|| anyhow!("{}: is not a valid adapter name", &adapter)) + .with_context(|| format!("{}: is not a valid adapter name", &adapter)) .and_then(|adapter| adapter.request_kind(&config)); let config_is_valid = request_type.is_ok(); @@ -932,15 +932,13 @@ impl RunningState { }; if config_is_valid { - // Ok(DebugTaskDefinition { - // label, - // adapter: DebugAdapterName(adapter), - // config, - // tcp_connection, - // }) } else if let Some((task, locator_name)) = build_output { let locator_name = - locator_name.context("Could not find a valid locator for a build task")?; + locator_name.with_context(|| { + format!("Could not find a valid locator for a build task and configure is invalid with error: {}", request_type.err() + .map(|err| err.to_string()) + .unwrap_or_default()) + })?; let request = dap_store .update(cx, |this, cx| { this.run_debug_locator(&locator_name, task, cx) @@ -956,7 +954,7 @@ impl RunningState { let scenario = dap_registry .adapter(&adapter) - .ok_or_else(|| anyhow!("{}: is not a valid adapter name", &adapter)) + .with_context(|| anyhow!("{}: is not a valid adapter name", &adapter)) .map(|adapter| adapter.config_from_zed_format(zed_config))??; config = scenario.config; Self::substitute_variables_in_config(&mut config, &task_context);