Skip to content

Commit

Permalink
fail if doc save sender is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
dead10ck committed Oct 17, 2022
1 parent 9c202c1 commit 80a9b3c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions helix-view/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))?;

Expand Down

0 comments on commit 80a9b3c

Please sign in to comment.