-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: promise is never resolved in case of using await
in if
block inside of catch
#109
Comments
try
block is generated instead of calling Try_Finally
inside of if
block in catch
await
in if
block inside of catch
It started happening after updating Just in case i've also pinned |
Thanks for the report. I'll try and work out why this regression happens. |
Quick update: this issue is block-nesting. If you remove the block enclosing the |
- Fix issue where `catch` body was incompletely transformed (see #109) - Fix issue where unreachable continuation generated an illegal Identifer after try-catch (see MatAtBread/fast-async#56)
Thx. Can confirm that it's working correctly now. |
You're welcome - thanks for the report and test case |
fast-async@6.3.6
nodent-transform@3.2.3
nodent-compiler@3.2.2
The problem is in an
if
block inside ofcatch
. It generates an emptytry {} catch ($boundEx)
inside of$Try_1_Catch
which results in$Try_1_Finally
never being called and promise never being resolved.Line 22 here:
http://nodent.mailed.me.uk/#async%20function%20test()%20%7B%0A%20%20%20%20try%20%7B%0A%20%20%20%20%20%20%20%20await%20Promise.reject(new%20Error('err'))%3B%0A%20%20%20%20%7D%20catch%20(error)%20%7B%0A%20%20%20%20%20%20%20%20if%20(true)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20await%20Promise.resolve()%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%20finally%20%7B%0A%20%20%20%20%20%20%20%20console.log('finally')%3B%0A%20%20%20%20%7D%0A%7D%0A%0Atest()%3B~options~%7B%22mode%22%3A%22promises%22%2C%22promiseType%22%3A%22native%22%2C%22noRuntime%22%3Atrue%2C%22es6target%22%3Atrue%2C%22wrapAwait%22%3Afalse%2C%22spec%22%3Afalse%7D
If you run this code
finally
block is never reachedThe text was updated successfully, but these errors were encountered: