call requirejs error handler for uncaught exceptions

Handle all uncaught exceptions using requirejs global error handler in order to allow easier error debugging/reporting.

```js
requirejs.onError = function (err) {
  alert(err);
};

require(['script'], function() {
  nonExistingFn();
});
```