Having what I thought should be a relatively easy problem to deal with being a major pain... I am trying to do:
a.b("param", function(data)
{
logger.debug("a.b(" + data.toString() + ")");
if (data.err == 0)
{
// No error, do stuff with data
}
else
{
// Error :( Redo the entire thing.
}
});
My approach to this was to try:
var theWholeThing = function() {return a.b("param", function(data)
{
logger.debug("a.b(" + data.toString() + ")");
if (data.err == 0)
{
// No error, do stuff with data
}
else
{
// Error :( Redo the entire thing.
theWholeThing();
}
})};
The problem with the above is while the former did work (except didnt deal when an error occurred), the latter simply never prints the log message... its as if "theWholeThing()" call isn't working as I thought it should (call the whole thing again).
There must be something subtly wrong here, any tips?
Thanks!