Commit 1dd581f5 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Added error handling to help detect errors, fixed community seach

parent f8fcaae4
......@@ -162,7 +162,7 @@ function sendjsonrequest(script, data, rtype, successcallback, errorcallback, qu
errtype = 'error';
}
else {
logWarn('invoking globalErrorHandler(', data, ')');
logWarning('invoking globalErrorHandler(', data, ')');
globalErrorHandler(data);
}
if (errtype) {
......@@ -170,19 +170,22 @@ function sendjsonrequest(script, data, rtype, successcallback, errorcallback, qu
if (!quiet) {
displayMessage(data.message, errtype);
}
successcallback(data);
try { successcallback(data); } catch (e) { logError('sendjsonrequest() callback failed: ', data); }
}
else if (data.message && typeof(data.message == 'object')) {
if (data.message.message && typeof(data.message.message == 'string') && !quiet) {
displayMessage(data.message.message, errtype);
}
successcallback(data.message);
try { successcallback(data); } catch (e) { logError('sendjsonrequest() callback failed: ', data); }
}
else {
successcallback(data);
try { successcallback(data); } catch (e) { logError('sendjsonrequest() callback failed: ', data); }
}
processingStop();
}
else {
processingStop();
}
},
function () {
displayMessage(get_string('unknownerror'), 'error');
......
......@@ -164,7 +164,13 @@ function TableRenderer(target, source, columns, options) {
self.offset = response.offset;
self.count = response.count;
self.updatecallback(response);
try {
self.updatecallback(response);
}
catch (e) {
logError('tablerenderer call updatecallback(', response, ') failed.');
}
if (self.paginate) {
if (typeof(self.assertPager) == 'function') {
self.assertPager(self.offset, self.limit, self.count);
......@@ -181,7 +187,9 @@ function TableRenderer(target, source, columns, options) {
showElement(self.table.previousSibling);
}
}
self.renderdata(response);
}, null, true);
};
......
......@@ -68,6 +68,9 @@ results.updatecallback = function (d) {
else {
results.linkspan = 1;
removeElement('userfields');
if ($('userfields')) {
removeElement('userfields');
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment