From 83241b54090d7d1a15b38bf0f5b15bf635fda9e2 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Tue, 30 Oct 2018 21:45:38 +0100 Subject: [PATCH] Add a console.error to visualize errors (#24581) --- .../kibana/public/visualize/editor/editor.js | 8 +++++--- .../public/visualize/loader/visualize_data_loader.ts | 12 +++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/core_plugins/kibana/public/visualize/editor/editor.js b/src/core_plugins/kibana/public/visualize/editor/editor.js index 489391c82705a..c0e0ac1624d0e 100644 --- a/src/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/core_plugins/kibana/public/visualize/editor/editor.js @@ -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 }; }); } diff --git a/src/ui/public/visualize/loader/visualize_data_loader.ts b/src/ui/public/visualize/loader/visualize_data_loader.ts index 982075e7f1fc5..5558843355db0 100644 --- a/src/ui/public/visualize/loader/visualize_data_loader.ts +++ b/src/ui/public/visualize/loader/visualize_data_loader.ts @@ -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, }); } }