remote config fixes (#12178)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-05-22 22:28:00 -06:00 committed by GitHub
parent af8641ce5b
commit 8b57d6d4c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 106 additions and 85 deletions

View file

@ -512,6 +512,13 @@ where
}
pub trait DetachAndPromptErr {
fn prompt_err(
self,
msg: &str,
cx: &mut WindowContext,
f: impl FnOnce(&anyhow::Error, &mut WindowContext) -> Option<String> + 'static,
) -> Task<()>;
fn detach_and_prompt_err(
self,
msg: &str,
@ -524,12 +531,12 @@ impl<R> DetachAndPromptErr for Task<anyhow::Result<R>>
where
R: 'static,
{
fn detach_and_prompt_err(
fn prompt_err(
self,
msg: &str,
cx: &mut WindowContext,
f: impl FnOnce(&anyhow::Error, &mut WindowContext) -> Option<String> + 'static,
) {
) -> Task<()> {
let msg = msg.to_owned();
cx.spawn(|mut cx| async move {
if let Err(err) = self.await {
@ -543,6 +550,14 @@ where
}
}
})
.detach();
}
fn detach_and_prompt_err(
self,
msg: &str,
cx: &mut WindowContext,
f: impl FnOnce(&anyhow::Error, &mut WindowContext) -> Option<String> + 'static,
) {
self.prompt_err(msg, cx, f).detach();
}
}