Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Jul 29, 2021
1 parent 8718a0a commit cf74efe
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions x-pack/plugins/reporting/server/routes/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import Boom from '@hapi/boom';
import { errors as elasticsearchErrors } from 'elasticsearch';
import { kibanaResponseFactory } from 'src/core/server';
import { ReportingCore } from '../';
import { API_BASE_URL } from '../../common/constants';
Expand All @@ -16,8 +15,6 @@ import { registerGenerateFromJobParams } from './generate_from_jobparams';
import { registerGenerateCsvFromSavedObjectImmediate } from './csv_searchsource_immediate';
import { HandlerFunction } from './types';

const esErrors = elasticsearchErrors as Record<string, any>;

const getDownloadBaseUrl = (reporting: ReportingCore) => {
const config = reporting.getConfig();
return config.kbnConfig.get('server', 'basePath') + `${API_BASE_URL}/jobs/download`;
Expand Down Expand Up @@ -77,24 +74,6 @@ export function registerJobGenerationRoutes(reporting: ReportingCore, logger: Lo
});
}

if (err instanceof esErrors['401']) {
return res.unauthorized({
body: `Sorry, you aren't authenticated`,
});
}

if (err instanceof esErrors['403']) {
return res.forbidden({
body: `Sorry, you are not authorized`,
});
}

if (err instanceof esErrors['404']) {
return res.notFound({
body: err.message,
});
}

// unknown error, can't convert to 4xx
throw err;
}
Expand Down

0 comments on commit cf74efe

Please sign in to comment.