Given the dynamically typed nature of JavaScript, a problem you may run into with building error handling into your application is how to tell if a given value actually is an error.
Take the following snippet of code:
var returnedValue = someFunction();
someFunction()
may return an error which was previously caught from within the…