Shopping cart implements exception logging from browser using:
window.onerror = function (errorMsg, url, lineNumber, column, errorObj) {
$.post('/Home/Error',
{
"errorMsg": errorMsg,
"url": url,
"lineNumber": lineNumber,
"column": column,
"errorobj": JSON.stringify(errorObj)
});
This logs strange errors about token o
:
Error Uncaught SyntaxError: Unexpected token o
This exception occurs 4-8 times again in same second form same IP address. After some time it occurs again in 4-8 times. There are small number of IP addresses from which its occurs. It looks like they are human IP addresses, not robots.
URLs and column numbers vary a bit:
Line 1 Column 2
Line 1 Column 10 Object {}
Line 1 Column 10 Object {}
Line 1 Column 9 Object {}
Line 1 Column 1 Object {}
Line number is 1 always:
object is empty.
There are 4 different column numbers: 1,2,9,10
HTTP headers in error posting request are:
Connection keep-alive
Content-Length 165
Content-Type application/x-www-form-urlencoded; charset=UTF-8
Accept */*
Accept-Encoding gzip, deflate
Accept-Language et-EE,et;q=0.8,en-US;q=0.6,en;q=0.4,de;q=0.2
Cookie __utma=117734412.255164026.1415001424.1415340483.1417604639.4; __utmz=117734412.1415001424.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=56901291.1707816279.1415687607.1418885975.1424090658.4; __utmz=56901291.1415687607.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); Eeva_Session=5BA67BC05470AD4E1BA6B3F6
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
X-Requested-With XMLHttpRequest
How to fix or diagnose this exception ?
Cart contains no o object probably. First line is <!DOCTYPE html>
User agent part without OS is always mostly the same:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
or
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
or
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
So it looks like it occurs in this particular browser only.
How to fix or diagnose this error so that it does not occur?
ASP.NET MVC4, jQuery, jQuery ui and few common jQuery plugins are used.
Update
Those pages contain few ajax calls. /Store/Browse contains ajax to add item to cart:
request = $.post('/Store/AddToCart',
serializedData, function (response) {
$("#cart-status").text(response.Total);
$inputs.prop("disabled", false);
var xx = $form[0].quantity;
$($form[0].quantity).css("background-color", "green");
showMessage(response.Message);
showFadeOutMessage(response.Message);
})
.fail(function (jqXHR, textStatus, errorThrown) {
alert('Viga ' + textStatus);
})
.always(function () {
$inputs.prop("disabled", false);
});
Store/Detail contains ajax to retrieve images:
$.get(
'/Store/Similar?product=TN_8627&category=3',
{
per_page: per_page,
page: page,
first: carousel.first,
last: carousel.last
},
function(data) {
mycarousel_itemAddCallback(carousel, first, last, data, page);
}
);
error occurs in both pages. JSON.Parse() which can cause this error according to I keep getting "Uncaught SyntaxError: Unexpected token o" answer is not used.
How to fix or diagnose them ?