Better error handling and code simplified

What's the advantage of referencing the function as a variable rather than declaring it as a simple function? In any case, the function should be named, for better stack traces: https://github.com/thanpolas/javascript#functions