Skip to content

Instantly share code, notes, and snippets.

@DimitarNestorov
Last active July 28, 2017 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DimitarNestorov/652596709382ef22e736499abcd6f911 to your computer and use it in GitHub Desktop.
Save DimitarNestorov/652596709382ef22e736499abcd6f911 to your computer and use it in GitHub Desktop.
[$rootScope:inprog] null already in progress
function exceptionHandler(){
const error = Error;
const nullMessage = "[$rootScope:inprog] null already in progress";
function exception(message){
if(message.indexOf(nullMessage) === 0){
const $rootScope = exceptionHandler.$rootScope;
if($rootScope) $rootScope.$$phase = null;
const exception = new error(nullMessage);
exception.stack = "";
return exception;
}
return new error(message);
}
Error = exception;
}
exceptionHandler(); // If it's not run AngularJS will use the original Error constructor, the one we're decorating
angular.run(["$rootScope", function($rootScope){
exceptionHandler.$rootScope = $rootScope;
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment