Thursday, 8 June 2017

call multiple functions nodejs

I just started with nodejs and I basically have two functions I want to execute and based on the success of each of those functions, or error of those functions, I want the wrapper function to generate an overall status code. I looked at the async package and I got it working in the happy path where everything succeeds and my last callback gets a success. But what if one fails? I see that the error gets sent to the last callback of async.waterfall, but the second function never gets run since there was an error and I do want to know the results of both functions. I've tried, series, parallel, and waterfall, and from what I can tell, they all call the final callback once an error is hit. Is there an idiomatic way to do this in Node?



via Crystal

No comments:

Post a Comment