I'm kinda new to NodeJS and doing some work with it.For the following code (kinesis is just AWS service) kinesis.putRecord(params, function (err, data) { if (err) { console.log("Failed to upload JSON to Kinesis!"); console.log(err, err.stack); // an error occurred } else { // upon success console.log("success") } }); I want that if the function "putRecord" fails, then I'll try it again once (If err exists try again)I guess I could put all in a function, initialize a boolean flag etc, but I think it's not very NodeJS style.How would you do it?E: found this:https://stackoverflow.com/a/23642571/7252805I'll try that I guess?
Submitted March 05, 2019 at 03:22PM by sheldonzy
No comments:
Post a Comment