window.onerror = function(message, url, line) {
    $.ajax('/api/Error', {
        data: {
            message: message,
            url: url,
            line: line
        }
    });
};

window.onerror = function(message, url, line) {
    // Don't attempt to handle non-standard errors (e.g. failed
    // HTTP request via jQuery).
    if (typeof message !== 'string') return;
    $.ajax('/api/Error', {
        data: {
            message: message,
            url: url,
            line: line
        }
    });
};

Fix for failure to serialize jQuery event object.
Fix for failure to serialize jQuery event object.
