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.
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 returnsnil
.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 fromvim.wait
to determine if a value should be returned or if an error should be thrown.