summaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
diff options
context:
space:
mode:
authorSkyler Hawthorne2022-10-17 02:41:01 +0000
committerSkyler Hawthorne2022-10-19 02:31:39 +0000
commit759d55cc81da10c93f6cbfcbe605806b9dc37d2f (patch)
treefd74f69da40fd70516f88255b6bb4d30bc56705c /helix-view/src/editor.rs
parente645804b0a8e42c9fb9ef8259a9b2ad47a57a6e6 (diff)
fail if doc save sender is closed
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r--helix-view/src/editor.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 9f74c5ec..ee84dbd3 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -1202,10 +1202,12 @@ impl Editor {
let path = path.map(|path| path.into());
let doc = doc_mut!(self, &doc_id);
let future = doc.save(path, force)?;
- // TODO: if no self.saves for that doc id then bail
- // bail!("saves are closed for this document!");
+
use futures_util::stream;
- self.saves[&doc_id]
+
+ self.saves
+ .get(&doc_id)
+ .ok_or_else(|| anyhow::format_err!("saves are closed for this document!"))?
.send(stream::once(Box::pin(future)))
.map_err(|err| anyhow!("failed to send save event: {}", err))?;