Closed KamilaBorowska closed 8 years ago
Thanks for your bug report!
I'm afraid your optimalization wouldn't work: what if db.destroy()
throws some error? In the first case, it would be transferred to the caller via the promise chain (you could add a .catch() block), but in the second case, it would throw an exception.
Now last time I checked this is actually something that regenerator does, but as far as I understand the spec, the current behaviour is actually correct.
Feel free to re-open if you think I missed something. :)
Oh, fair enough. I didn't even realize this edge case.
One of the advantages of writing such a project is learning a lot about edge cases - and I'm sure there are still plenty out there, so keep the bugs reports coming if you spot something else.
README shows the following code.
I believe this can be optimized into the following (Promise.resolve causes promise to stay as promise, while changing non-promise values into promises).
This isn't particularly important, because it's purely an optimization, just bringing it up for later.