With AngularJS, you can process errors your way by implementing $exceptionHandler. (Otherwise errors originating within framework wouldn't reach window.onerror—default implementation of $exceptionHandler will catch them and log to console.)
This code, for example, reports each otherwise unhandled exception to user prettily using Messenger.js:
window.angular.module('yourApp', []).
// <…>
factory('$exceptionHandler', [
'$log',
function ($log) {
return function (exception, cause) {
// Log to console
$log.error.apply($log, arguments);
// Show to user
var msg = sprintf("Error: %s", exception.message);
if (cause) { msg = sprintf("%s. %s", msg, cause); }
window.Messenger().post({
type: 'error',
hideAfter: 0,
showCloseButton: true,
message: msg
});
};
}
]);
To replicate functionality from the article, you could make a request using $http service in there.
(I assume it's possible to override not $exceptionHandler, but $log service directly. This would allow for more extensive server-side log collection, not just error reporting. Never tried that myself, though.)
I discovered StackTrace.js does not give usable results on IPAD 1 and on Iphone 3GS ( these are the only IOS devices I own and had the pleasure of testing with Stacktrace). And it is useless when using with google closure compiler generated javascript code.
I have refactored my js code to have try - catch block in all my critical paths in Babckbone modules; this approach works on all google closure compiler generate javascript code. I really wonder why most people don't do this more often.
Slightly off-topic, but please have someone proofread your stuff. In addition to "shear number" (it's sheer number), on the Metric.io home page I noticed the following at first glance:
"free trail", "build lasting realtionships", "Create pomotions", "siing how your customers are interacting"
You've got a beautiful site but these sorts of errors give the wrong first impression.
Apparently "shear number" is a thing, though presumably not the thing meant here:
'All beta-barrels can be classified in terms of two integer parameters: the number of strands in the beta-sheet, n, and the "shear number", S, a measure of the stagger of the strands in the beta-sheet.'
This so many times discussed. In short use window.onerror handler and some transport depending on needs: like cors support, before and after load loggin etc.
For begining you can just put all errors to google analytics and have all kinds of reports, stat by browsers and export to gdocs.
This code, for example, reports each otherwise unhandled exception to user prettily using Messenger.js:
To replicate functionality from the article, you could make a request using $http service in there.(I assume it's possible to override not $exceptionHandler, but $log service directly. This would allow for more extensive server-side log collection, not just error reporting. Never tried that myself, though.)