[hotfix] handling json errors in explore view
This commit is contained in:
parent
89cb726284
commit
5bea3986b2
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ const controllerInterface = {
|
|||
getFilters: () => false,
|
||||
clearFilter: () => {},
|
||||
removeFilter: () => {},
|
||||
filters: {},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue