$$ForceReflowProvider = function() {
  this.$get = ['$document', function($document) {
    return function(domNode) {
      //the line below will force the browser to perform a repaint so
      //that all the animated elements within the animation frame will
      //be properly updated and drawn on screen. This is required to
      //ensure that the preparation animation is properly flushed so that
      //the active state picks up from there. DO NOT REMOVE THIS LINE.
      //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH
      //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND
      //WILL TAKE YEARS AWAY FROM YOUR LIFE.
      if (domNode) {
        if (!domNode.nodeType && domNode instanceof jqLite) {
          domNode = domNode[0];
        }
      } else {
        domNode = $document[0].body;
      }
      return domNode.offsetWidth + 1;
    };
  }];
}
@ngdoc service
@name $exceptionHandler
@requires ng.$log

@description
Any uncaught exception in angular expressions is delegated to this service.
The default implementation simply delegates to `$log.error` which logs it into
the browser console.

In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
{@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.

## Example:

The example below will overwrite the default `$exceptionHandler` in order to (a) log uncaught
errors to the backend for later inspection by the developers and (b) to use `$log.warn()` instead
of `$log.error()`.

```js
  angular.
    module('exceptionOverwrite', []).
    factory('$exceptionHandler', ['$log', 'logErrorsToBackend', function($log, logErrorsToBackend) {
      return function myExceptionHandler(exception, cause) {
        logErrorsToBackend(exception, cause);
        $log.warn(exception, cause);
      };
    }]);
```

<hr />
Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`
methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}
(unless executed during a digest).

If you wish, you can manually delegate exceptions, e.g.
`try { ... } catch(e) { $exceptionHandler(e); }`

@param {Error} exception Exception associated with the error.
@param {string=} cause Optional information about the context in which
      the error was thrown.