Skip to content

Instantly share code, notes, and snippets.

@roelentless
Created March 18, 2016 13:47
Show Gist options
  • Save roelentless/d330b9cad05a6a43cd09 to your computer and use it in GitHub Desktop.
Save roelentless/d330b9cad05a6a43cd09 to your computer and use it in GitHub Desktop.
Put all $log errors in a global variable "errors" so you have a log of errors that happen before you have access to the console.
angular
.module('app', [])
.config(['$provide', function ($provide) {
window.errors = [];
$provide.decorator('$log', ['$delegate', function ($delegate) {
var origError = $delegate.error;
$delegate.error = function () {
window.errors.push(arguments);
origError.apply(null, arguments);
};
return $delegate;
}]);
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment