tag:blogger.com,1999:blog-1397115249631682228.post1872997511804910854..comments2024-03-29T05:41:44.373+01:00Comments on Sander van der Burg's blog: Structured asynchronous programming (Asynchronous programming with JavaScript part 3)Sander van der Burghttp://www.blogger.com/profile/12718166966821611609noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-1397115249631682228.post-60991559074105434052016-06-29T17:48:48.617+02:002016-06-29T17:48:48.617+02:00The Haskell async library can propagate exceptions...The Haskell async library can propagate exceptions from async computations easily. I wonder how to compare it to promise monads. https://ocharles.org.uk/blog/posts/2013-12-13-24-days-of-hackage-async.htmlCMCDragonkaihttps://www.blogger.com/profile/00988750090264744377noreply@blogger.comtag:blogger.com,1999:blog-1397115249631682228.post-43123133713292854562016-02-22T18:42:34.918+01:002016-02-22T18:42:34.918+01:00You should check out ember-concurrency.com for an ...You should check out ember-concurrency.com for an approach to async structured programming that leverages ES2015 generator function syntax.Alexhttps://www.blogger.com/profile/07421879968990541632noreply@blogger.comtag:blogger.com,1999:blog-1397115249631682228.post-60745565006268289172014-05-28T13:02:28.386+02:002014-05-28T13:02:28.386+02:00Hmm two months later, and it seems that I have mis...Hmm two months later, and it seems that I have missed this question!<br /><br />It looks like I have slightly "violated" one of the "rules" that I have set in the exception example.<br /><br />So in the earlier example demonstrating my attempt() function abstraction, the finally function parameter (which is a callback) should also follow the same convention used for any other callback. In other words, it should do something with the err parameter:<br /><br />slasp.attempt(function(callback) {<br /> ... <br /> ], callback);<br />}, function(err, callback) {<br /> printOnConsole("Some exception occured: "+err, callback);<br />}, function(err) {<br /> // Do something with the err parameter to catch the exception thrown in the capture function block<br />});<br /><br />By using the err parameter in the finally callback, we can capture the exception that might be thrown in the capture() block.<br /><br />Furthermore, as far as I can see, it's also possible to wrap another attempt() block around the earlier code fragment and we can use that surrounding block to capture the exception thrown in the inner catch block.<br /><br />However, to make all this stuff work we should "stick" ourselves to the new conventions that we have set. If, for example, we forget invoking a callback somewhere then everything collapses.<br />Sander van der Burghttps://www.blogger.com/profile/12718166966821611609noreply@blogger.comtag:blogger.com,1999:blog-1397115249631682228.post-85669574139723328602014-03-25T10:28:59.611+01:002014-03-25T10:28:59.611+01:00Awesome! One question is how do you deal with erro...Awesome! One question is how do you deal with errors while in a callback.Georgios Gousioshttps://www.blogger.com/profile/17125139972066500978noreply@blogger.com