I often see node.js programmers, when calling functions that expect callbacks, do this:
callSomeThing(arg1, arg2, function (err, data) {
if(err) {
// Handle the error case
} else {
// Proceed normally
}
});
Is there any technical reason why they use an else block instead of returning in the error case or is it just a code style thing?
callSomeThing(arg1, arg2, function (err, data) {
if(err) {
// Handle the error case
return;
}
// proceed normally
});