Angular: Empty Fiddle
http://angularjs.org/
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.0/angular.js"></script>
<div ng-controller="MyCtrl">
Hello, {{name}}!
</div>
JavaScript
var myApp = angular.module('myApp',[]);
myApp.factory('$exceptionHandler', function() {
return function(exception, cause) {
exception.message += ' (caused by "' + cause + '")';
//throw exception;
};
});
myApp.controller('MyCtrl', function MyCtrl($scope, $q) {
$scope.name = 'Superhero';
$q.when(1)
.then(function() {
throw new Error("test");
}).catch(function(error) {
console.log('error caught', error);
});
});