I have a function that calculates the aspect ratio of a height and a width input, and either throws an error, or returns an object with the aspect ratio.
var bestAR = dimensions.map(function(dim) {
try {
return findBestAR(dim.width, dim.height);
}
catch (e) {
return new Bacon.Error(e);
}
});
bestAR.onError(function(e) {
alert(e)
});
I can log the new Bacon.Error
in my catch statement to the console and it contains the thrown error inside of findBestAR
. However, it does not respond to the onError
per Bacon. Maybe I'm not fully understanding how error handling in Bacon works.