Skip to content

Commit

Permalink
Add return type. Rename interface
Browse files Browse the repository at this point in the history
  • Loading branch information
John Schulz committed Sep 3, 2020
1 parent df19026 commit 427df9c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions x-pack/plugins/ingest_manager/server/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@

/* eslint-disable max-classes-per-file */
import Boom from 'boom';
import { RequestHandlerContext, KibanaRequest, KibanaResponseFactory } from 'src/core/server';
import {
RequestHandlerContext,
KibanaRequest,
IKibanaResponse,
KibanaResponseFactory,
} from 'src/core/server';
import { appContextService } from './services';

export class IngestManagerError extends Error {
Expand All @@ -27,7 +32,7 @@ export const getHTTPResponseCode = (error: IngestManagerError): number => {
return 400; // Bad Request
};

interface IngestErrorHandler {
interface IngestErrorHandlerParams {
error: IngestManagerError | Boom | Error;
response: KibanaResponseFactory;
request?: KibanaRequest;
Expand All @@ -39,7 +44,7 @@ export const defaultIngestErrorHandler = async ({
request,
response,
context,
}: IngestErrorHandler) => {
}: IngestErrorHandlerParams): Promise<IKibanaResponse> => {
const logger = appContextService.getLogger();
if (error instanceof IngestManagerError) {
logger.error(error.message);
Expand Down

0 comments on commit 427df9c

Please sign in to comment.