{"id":6392,"date":"2014-04-17T01:15:07","date_gmt":"2014-04-17T01:15:07","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/17\/problem-about-node-async-collection-of-common-programming-errors\/"},"modified":"2014-04-17T01:15:07","modified_gmt":"2014-04-17T01:15:07","slug":"problem-about-node-async-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/17\/problem-about-node-async-collection-of-common-programming-errors\/","title":{"rendered":"problem about node-async-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f9072ae53c549431cf41eefbd436575d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nlemulot<br \/>\nnode.js error-handling express waterfall node-async<br \/>\nI don&#8217;t see why expressjs don&#8217;t handle error when it&#8217;s throw in async.waterfallvar express = require(&#8216;express&#8217;) , app = express.createServer() , async = require(&#8216;async&#8217;);app.use(express.errorHandler({dumpExceptions: true,showStack: true }));app.get(&#8216;\/error&#8217;, function(req, res){throw Error(&#8216;Aie&#8217;); });app.get(&#8216;\/asyncerror&#8217;, function(req, res){var that = this;async.waterfall([function(next){console.log(&#8216;1&#8217;);next(&#8220;42&#8221;, &#8220;2&#8221;);},function(arg, next) {console.log(arg);res.json(&#8216;ok&#8217;);}], function(err){con<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ef481672aea2e99def679b781127062c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTolga E<br \/>\njavascript json node.js node-async<br \/>\nI basically need to make about 3 calls to get the data for a json object.. It basically JSON array of JSON object which have some attributes, one of which is an array of other values selected using a second query, then that one also has an array inside which is selected with another db call.I tried using asyn.concatSeries so that I can dig down into the bottom call and put together all the information I collected for one root json object but that&#8217;s creating a lot of unexpected behaviour..Exampl<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b0f914780b79358ef988a7ba6208746b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nhippietrail<br \/>\njavascript node.js async.js node-async<br \/>\nHere I&#8217;m trying to make an array of functions with arguments to Async.js.The array consists of instances of RunRequest that are supposed to be set inside the loop in MakeRequest, right before I try pass the function array to Async.So the request in request[i] is fine when I pass it to RunRequest, but inside RunRequest function its undefined?\/\/ Process Requests function RunRequest(db, collection, request, requestHandler, callback) {console.log(&#8216;this happening?&#8217;)\/\/ Connect to the databasedb.open(f<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/98a2a8a3bdc203ab221d3f5534d0b03f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMunim<br \/>\nxml node.js node-async<br \/>\nI have to process a large XML file (around 25 mb in size), and organize the data into documents to import into MongoDB. The issue is, there are around 5-6 types of elements in the xml document, each with around 10k rows. After fetching one xml node of type a, I have to fetch it&#8217;s corresponding elements of types b,c,d, etc.What I am trying to do in node:Fetch all the rows of type a. For each row, using xpath, find its corresponding related rows, and create the document. Insert document in mongo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b0f914780b79358ef988a7ba6208746b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nhippietrail<br \/>\njavascript node.js loops async.js node-async<br \/>\nThe popular node.js module async includes functions for collections and control flow which, with versions of some which can be operate in parallel or in series.But among them I cannot find a way to construct a loop which operates in series.I&#8217;m trying to do the same as this pseudocode:forever {l = getline();if (l === undefined) {break;} else {doStuff(l);} }If I wanted all the calls to getLine() to be called in parallel I could use async.whilst. If I wanted to iterate over an array rather than mak<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b0f914780b79358ef988a7ba6208746b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nhippietrail<br \/>\nnode.js async.js node-async<br \/>\nI&#8217;m working with the parallel function in Async.js and for some reason the final call back is not getting executed and I do not see an error happening anywhere. I&#8217;m dynamically creating an array of functions that are passed to the parallel call as such: \/\/ &#8216;theFiles&#8217; is an array of files I&#8217;m working with in a code-generator style type of scenario var callItems = []; theFiles.forEach(function(currentFile) {var genFileFunc = generateFileFunc(destDir + &#8220;\/&#8221; + currentFile, packageName, appName);callI<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>lemulot node.js error-handling express waterfall node-async I don&#8217;t see why expressjs don&#8217;t handle error when it&#8217;s throw in async.waterfallvar express = require(&#8216;express&#8217;) , app = express.createServer() , async = require(&#8216;async&#8217;);app.use(express.errorHandler({dumpExceptions: true,showStack: true }));app.get(&#8216;\/error&#8217;, function(req, res){throw Error(&#8216;Aie&#8217;); });app.get(&#8216;\/asyncerror&#8217;, function(req, res){var that = this;async.waterfall([function(next){console.log(&#8216;1&#8217;);next(&#8220;42&#8221;, &#8220;2&#8221;);},function(arg, next) {console.log(arg);res.json(&#8216;ok&#8217;);}], function(err){con Tolga E javascript json node.js node-async I basically need [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6392","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6392"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6392\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}