Skip to content

Instantly share code, notes, and snippets.

@mosquito
Created October 22, 2014 11:17
Show Gist options
  • Save mosquito/4199e94d8668138d1073 to your computer and use it in GitHub Desktop.
Save mosquito/4199e94d8668138d1073 to your computer and use it in GitHub Desktop.
app.factory('$exceptionHandler', function () { return function (e) { errorHandler(e); }; });
Array.prototype.unique = function(a){return function(){ return this.filter(a) }}(function(a,b,c){ return c.indexOf(a,b+1) < 0 });
String.prototype.capitalize = function() { var s = this.toLowerCase(); return s.charAt(0).toUpperCase() + s.slice(1); };
Q.onerror = function (e) { errorHandler(e); };
Q.stopUnhandledRejectionTracking();
function errorHandler (e) {
if (e.stack) {
Raven.captureException(e);
if (window.console) {
window.console.error(e.stack);
}
} else {
Raven.captureMessage(JSON.stringify(e));
if (window.console) {
window.console.error(e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment