[hotfix] handling json errors in explore view

This commit is contained in:
Maxime Beauchemin 2016-10-12 19:36:48 -07:00
parent 89cb726284
commit 5bea3986b2
2 changed files with 14 additions and 3 deletions

View File

@ -150,15 +150,25 @@ const px = function () {
return msg;
},
error(msg, xhr) {
let errorMsg = msg;
token.find('img.loading').hide();
let err = msg ? '<div class="alert alert-danger">' + msg + '</div>' : '';
let errHtml = '';
try {
const o = JSON.parse(msg);
if (o.error) {
errorMsg = o.error;
}
} catch (e) {
// pass
}
errHtml = `<div class="alert alert-danger">${errorMsg}</div>`;
if (xhr) {
const extendedMsg = this.getErrorMsg(xhr);
if (extendedMsg) {
err += '<div class="alert alert-danger">' + extendedMsg + '</div>';
errHtml += `<div class="alert alert-danger">${extendedMsg}</div>`;
}
}
container.html(err);
container.html(errHtml);
container.show();
$('span.query').removeClass('disabled');
$('#timer').addClass('btn-danger');

View File

@ -116,6 +116,7 @@ const controllerInterface = {
getFilters: () => false,
clearFilter: () => {},
removeFilter: () => {},
filters: {},
};
module.exports = {