Skip to content

Commit 82447ae

Browse files
committed
[ML] Remove unneeded try/catch blocks.
1 parent 4da1352 commit 82447ae

File tree

1 file changed

+16
-26
lines changed

1 file changed

+16
-26
lines changed

x-pack/plugins/ml/public/application/components/data_grid/use_column_chart.tsx

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,15 @@ const getAggIntervals = async (
9898
return aggs;
9999
}, {} as Record<string, object>);
100100

101-
let respStats: any;
102-
try {
103-
respStats = await esSearch({
104-
index: indexPatternTitle,
101+
const respStats = await esSearch({
102+
index: indexPatternTitle,
103+
size: 0,
104+
body: {
105+
query,
106+
aggs: minMaxAggs,
105107
size: 0,
106-
body: {
107-
query,
108-
aggs: minMaxAggs,
109-
size: 0,
110-
},
111-
});
112-
} catch (e) {
113-
throw new Error(e);
114-
}
108+
},
109+
});
115110

116111
return Object.keys(respStats.aggregations).reduce((p, aggName) => {
117112
const stats = [respStats.aggregations[aggName].min, respStats.aggregations[aggName].max];
@@ -199,20 +194,15 @@ export const fetchChartsData = async (
199194
return [];
200195
}
201196

202-
let respChartsData: any;
203-
try {
204-
respChartsData = await esSearch({
205-
index: indexPatternTitle,
197+
const respChartsData = await esSearch({
198+
index: indexPatternTitle,
199+
size: 0,
200+
body: {
201+
query,
202+
aggs: chartDataAggs,
206203
size: 0,
207-
body: {
208-
query,
209-
aggs: chartDataAggs,
210-
size: 0,
211-
},
212-
});
213-
} catch (e) {
214-
throw new Error(e);
215-
}
204+
},
205+
});
216206

217207
const chartsData: ChartData[] = columnTypes.map(
218208
(c): ChartData => {

0 commit comments

Comments
 (0)