javascript - asyncawait module (node) yields unusable stack traces -
i having problem using async/await implementation node.js (https://github.com/yortus/asyncawait).
in documentation says "will include useable stack trace". not me. think doing wrong..but don't know i'm doing wrong.
to demonstrate compare stacktrace of "vanilla" bluebird example corresponding stacktrace of corresponding asyncawait code (asyncawait uses bluebird internally think it's fair).
first bluebird code without asyncawait:
var funcb = function() { return promise.resolve().then(function() { throw new error("some err"); }) }; var funca = function() { return funcb(); }; gulp.task("aa",function(cb) { funca().then(function() { cb(); }); });
the stacktrace yields information "funca -> funcb -> exception" @ first glace. not better!
error: error: err @ processimmediate [as _immediatecallback] (timers.js:358:17) previous event: @ funcb (c:\projects\jsbuildhelper\jsbuildhelper\tmp\tsreq\app\gulpfile.js:156:30) @ funca (c:\projects\jsbuildhelper\jsbuildhelper\tmp\tsreq\app\gulpfile.js:161:12) @ gulp.<anonymous> (c:\projects\jsbuildhelper\jsbuildhelper\tmp\tsreq\app\gulpfile.js:164:5) @ module.exports (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\gulp\node_modules\orchestrator\lib\runtask.js:34:7) @ gulp.orchestrator._runtask (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\gulp\node_modules\orchestrator\index.js:273:3) @ gulp.orchestrator._runstep (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\gulp\node_modules\orchestrator\index.js:214:10) @ gulp.orchestrator.start (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\gulp\node_modules\orchestrator\index.js:134:8) @ c:\users\alex\appdata\roaming\npm\node_modules\gulp\bin\gulp.js:129:20 @ process._tickcallback (node.js:355:11) @ function.module.runmain (module.js:503:11) @ startup (node.js:129:16) @ node.js:814:3
now corresponding asyncawait code:
var funcb = async(function() { throw new error("some err"); }); var funca = async(function () { await(funcb()); }); gulp.task("aa", function(cb) { funca().then(function() { cb(); }); });
in stacktrace see exception. no "funca", no "funcb".
for simple program sufficient. but can't use other more complex stuff, considering how important stacktraces are..
possibly unhandled error: error: err @ catchblock (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\asyncawait\src\async\fibermanager.js:51:25) @ runinfiber (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\asyncawait\src\async\fibermanager.js:29:9) previous event: @ new promise (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\asyncawait\node_modules\bluebird\js\main\promise.js:84:37) @ defer (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\asyncawait\src\async\defer.js:6:19) @ noniterable (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\asyncawait\src\async\makeasyncfunc.js:86:28) @ f0 (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\asyncawait\src\async\makeasyncfunc.js:119:23) @ gulp.<anonymous> (c:\projects\jsbuildhelper\jsbuildhelper\tmp\tsreq\app\gulpfile.js:162:5) @ module.exports (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\gulp\node_modules\orchestrator\lib\runtask.js:34:7) @ gulp.orchestrator._runtask (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\gulp\node_modules\orchestrator\index.js:273:3) @ gulp.orchestrator._runstep (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\gulp\node_modules\orchestrator\index.js:214:10) @ gulp.orchestrator.start (c:\projects\jsbuildhelper\jsbuildhelper\node_modules\gulp\node_modules\orchestrator\index.js:134:8) @ c:\users\alex\appdata\roaming\npm\node_modules\gulp\bin\gulp.js:129:20 @ function.module.runmain (module.js:503:11) @ startup (node.js:129:16) @ node.js:814:3
am doing wrong or limitition cannot remove?
Comments
Post a Comment