Add a console.error to visualize errors (#24581)

This commit is contained in:
Marco Vettorello 2018-10-30 21:45:38 +01:00 committed by GitHub
parent 8702792673
commit 2e450896c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View file

@ -416,13 +416,15 @@ function VisEditor(
}
});
return { id };
}, (err) => {
}, (error) => {
// eslint-disable-next-line
console.error(error);
toastNotifications.addDanger({
title: `Error on saving '${savedVis.title}'`,
text: err.message,
text: error.message,
'data-test-subj': 'saveVisualizationError',
});
return { error: err };
return { error };
});
}

View file

@ -94,11 +94,13 @@ export class VisualizeDataLoader {
this.visData = await Promise.resolve(this.responseHandler(requestHandlerResponse));
}
return this.visData;
} catch (e) {
} catch (error) {
params.searchSource.cancelQueued();
this.vis.requestError = e;
this.vis.showRequestError = e.type && e.type === 'UNSUPPORTED_QUERY';
if (isTermSizeZeroError(e)) {
this.vis.requestError = error;
this.vis.showRequestError = error.type && error.type === 'UNSUPPORTED_QUERY';
// tslint:disable-next-line
console.error(error);
if (isTermSizeZeroError(error)) {
return toastNotifications.addDanger(
`Your visualization ('${this.vis.title}') has an error: it has a term ` +
`aggregation with a size of 0. Please set it to a number greater than 0 to resolve ` +
@ -107,7 +109,7 @@ export class VisualizeDataLoader {
}
toastNotifications.addDanger({
title: 'Error in visualization',
text: e.message,
text: error.message,
});
}
}