Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Promise.coroutine() is difficult to debug #421
First of all thanks for your great work on bluebird.
The following code sample (at scale) is very difficult to debug:
I understand that it's likely impossible to capture a perfect stack trace, but I spent hours tracking down this bug and was hoping to get a better error message. I took a rough pass at an improvement here: petehunt@d15a93c
Is this something worth cleaning up and trying to get in? Or is this something you'd want to do? Or is this not worth doing?
Very awesome of you to open this issue we were just debating yesterday why people are getting
We take the ability to debug code very seriously. What do you think a meaningful stack trace would be here? None of the userland functions here are named.
w/ my patch above on a modified test file (https://github.com/petehunt/bluebird/blob/d15a93ca57c24c8a935be35b8c62a6b2123e03a7/demo.js) I was able to get it to this (note the "from coroutine" bit):
This is I think about as good as we can get without using a syntax transform to capture the stack trace at the point of yielding (unless you guys have some magic for introspecting where a generator currently is at).
Thanks for this, as @benjamingr says debuggability is very important and we are constantly trying to find improvement in that area.
I don't see any harm in it, the coroutine function should not be called at runtime anyway so it can do expensive setup stuff.
Before pull request remove the js/browser/bluebird.js from the commit (this is only commited in release commits for a download link, I should get a real CDN)