Skip to content

Commit 9bca023

Browse files
Shutdown debug session when launch/attach fails
Co-Authored-By: Anthony Eid <[email protected]>
1 parent 647f411 commit 9bca023

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

crates/debugger_ui/src/debugger_panel.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl DebugPanel {
582582

583583
task.await?;
584584

585-
match request_type {
585+
let result = match request_type {
586586
DebugRequestType::Launch => {
587587
let task = this.update(&mut cx, |this, cx| {
588588
this.dap_store
@@ -615,7 +615,23 @@ impl DebugPanel {
615615
})?
616616
}
617617
}
618+
};
619+
620+
if result.is_err() {
621+
this.update(&mut cx, |debug_panel, cx| {
622+
debug_panel.dap_store.update(cx, |store, cx| {
623+
cx.emit(DapStoreEvent::Notification(
624+
"Failed to start debug session".into(),
625+
));
626+
627+
store
628+
.shutdown_session(&session_id, cx)
629+
.detach_and_log_err(cx);
630+
});
631+
})?;
618632
}
633+
634+
result
619635
})
620636
.detach_and_log_err(cx);
621637
}

0 commit comments

Comments
 (0)