1function submitClientError(obj, cb) { 2 obj.href = window.location.href; 3 obj.ua = navigator.userAgent; 4 $.ajax({ 5 url: '/api/log/error', 6 type: 'POST', 7 headers: { 8 'Content-Type': 'application/json', 9 'x-csrf-token': csrf_token 10 }, 11 data: JSON.stringify(obj), 12 dataType: 'json', 13 success: function(d) { 14 if (cb) { 15 cb(null, d); 16 } 17 }, 18 failure: function() { 19 console.log("Failed to send error log"); 20 if (cb) { 21 cb("Failed to send error log", null); 22 } 23 } 24 }); 25} 26 27 28window.onerror = function(msg, url, lineNo, columnNo, error) { 29 var string = msg.toLowerCase(); 30 var substring = "script error"; 31 if (string.indexOf(substring) > -1) { 32 submitClientError({ 33 error: 'Script Error: See Browser Console for Detail. ' + string 34 }); 35 } else { 36 var message = [ 37 'Message: ' + msg, 38 'URL: ' + url, 39 'Line: ' + lineNo, 40 'Column: ' + columnNo, 41 'Error object: ' + JSON.stringify(error) 42 ].join(' - '); 43 44 submitClientError({ 45 error: message 46 }); 47 } 48 49 return false; 50};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.