Skip to content

Commit

Permalink
Add a console.error to visualize errors (elastic#24581) (elastic#24867)
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 authored and jasonrhodes committed Oct 31, 2018
1 parent 3bc9ab0 commit f5096ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/core_plugins/kibana/public/visualize/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
});
}

Expand Down
12 changes: 7 additions & 5 deletions src/ui/public/visualize/loader/visualize_data_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ` +
Expand All @@ -107,7 +109,7 @@ export class VisualizeDataLoader {
}
toastNotifications.addDanger({
title: 'Error in visualization',
text: e.message,
text: error.message,
});
}
}
Expand Down

0 comments on commit f5096ad

Please sign in to comment.