Skip to content

Commit

Permalink
[Uptime] Delete useless try...catch blocks (elastic#58263)
Browse files Browse the repository at this point in the history
* Delete useless try...catch blocks.

* Delete unneeded function.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
justinkambic and elasticmachine committed Feb 24, 2020
1 parent 2065ac5 commit dc7705c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
10 changes: 3 additions & 7 deletions x-pack/legacy/plugins/uptime/public/hooks/use_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ const getApiPath = (page?: UptimePage) => {
};

const logPageLoad = async (fetch: HttpHandler, page?: UptimePage) => {
try {
await fetch(getApiPath(page), {
method: 'POST',
});
} catch (e) {
throw e;
}
await fetch(getApiPath(page), {
method: 'POST',
});
};

export const useUptimeTelemetry = (page?: UptimePage) => {
Expand Down
1 change: 0 additions & 1 deletion x-pack/legacy/plugins/uptime/server/lib/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
export { getFilterClause } from './get_filter_clause';
export { parseRelativeDate } from './get_histogram_interval';
export { getHistogramIntervalFormatted } from './get_histogram_interval_formatted';
export { parseFilterQuery } from './parse_filter_query';
export { assertCloseTo } from './assert_close_to';
export { objectValuesToArrays } from './object_to_array';

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { UMElasticsearchQueryFn } from '../adapters';
import { parseFilterQuery, getFilterClause } from '../helper';
import { getFilterClause } from '../helper';
import { INDEX_NAMES, QUERY } from '../../../common/constants';
import { HistogramQueryResult } from './types';
import { HistogramResult } from '../../../common/types';
Expand All @@ -27,7 +27,7 @@ export const getPingHistogram: UMElasticsearchQueryFn<
GetPingHistogramParams,
HistogramResult
> = async ({ callES, from, to, filters, monitorId, statusFilter }) => {
const boolFilters = parseFilterQuery(filters);
const boolFilters = filters ? JSON.parse(filters) : null;
const additionalFilters = [];
if (monitorId) {
additionalFilters.push({ match: { 'monitor.id': monitorId } });
Expand Down

0 comments on commit dc7705c

Please sign in to comment.