nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
2.8k stars 121 forks source link

Update promise.wait to throw an error when timeout reached or interrupted #723

Closed chipsenkbeil closed 3 weeks ago

chipsenkbeil commented 3 weeks ago

Per the comment I made in our main org roam issue, I discovered that Promise.wait does not throw an error when the timeout is reached. Instead, it returns nil.

This can be a problem if you're returning OrgPromise<nil>, as it misleads the promise as succeeding when in reality it may have not completed yet.

This updates Promise.wait to check the return values from vim.wait to determine if a value should be returned or if an error should be thrown.

chipsenkbeil commented 3 weeks ago

Looks good, just some minor refactoring around the checks.

Good to go :)

kristijanhusak commented 3 weeks ago

Thanks!