Skip to content

Instantly share code, notes, and snippets.

@Melonbwead
Created January 20, 2014 16:48
Show Gist options
  • Save Melonbwead/8523775 to your computer and use it in GitHub Desktop.
Save Melonbwead/8523775 to your computer and use it in GitHub Desktop.
error js
window.onerror = function(message, url, line) {
window.log('EXCEPTION', message + "|" + url + "|" + line);
return window.log_error('Exception', message, window.location.pathname, url, line);
};
var __slice = [].slice;
window.log_error = function() {
var arg, args, error_name, message;
error_name = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
message = [
(function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = args.length; _i < _len; _i++) {
arg = args[_i];
_results.push(arg.toString());
}
return _results;
})()
].join("|");
message = error_name + '|' + message + '|' + window.navigator.userAgent;
return alert(message);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment