Skip to content

Commit

Permalink
extensions_ui: Show an error toast when a dev extension fails to install
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdeviant committed Jan 9, 2025
1 parent 9ea7ed8 commit 1248c44
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
21 changes: 17 additions & 4 deletions crates/extensions_ui/src/extensions_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,26 @@ pub fn init(cx: &mut AppContext) {
}
};

store
let install_task = store
.update(&mut cx, |store, cx| {
store
.install_dev_extension(extension_path, cx)
.detach_and_log_err(cx)
store.install_dev_extension(extension_path, cx)
})
.ok()?;

match install_task.await {
Ok(_) => {}
Err(err) => {
workspace_handle
.update(&mut cx, |workspace, cx| {
workspace.show_error(
&err.context("failed to install dev extension"),
cx,
);
})
.ok();
}
}

Some(())
})
.detach();
Expand Down
3 changes: 3 additions & 0 deletions crates/workspace/src/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,10 @@ impl Render for ErrorMessagePrompt {
)
.child(
div()
.id("error_message")
.max_w_80()
.max_h_40()
.overflow_y_scroll()
.child(Label::new(self.message.clone()).size(LabelSize::Small)),
)
.when_some(self.label_and_url_button.clone(), |elm, (label, url)| {
Expand Down

0 comments on commit 1248c44

Please sign in to comment.