Programmers seem to be divided on how to receive error notification asynchronously.
Some programmers prefer to use a callback with two arguments: a value and a boolean value that indicates whether this value is erroneous. This has the advantage of looking like an operator try catch:
asyncFunct(function (value, noError) {
if (noError) {
} else {
}
});
Others prefer negative (i.e. a boolean should indicate whether the value is erroneous). Their argument is that if you know that an asynchronous function will never cause an error, you can safely omit the second parameter as follows:
asyncFunction(function (value, isErroneous) {
if (!isErrorneous) {
} else {
}
});
asyncFunction(function (value) {
});
, . , , errbacks, none:
asyncFunction(function (value) {
}, function (error) {
});
asyncFunction(function (value) {
});
asyncFunction(null, function (error) {
});
, . , , , .