Skip to content

Commit

Permalink
Update x-pack/plugins/infra/server/routes/log_analysis/results/log_en…
Browse files Browse the repository at this point in the history
…try_rate_examples.ts

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
  • Loading branch information
Kerry350 and weltenwort authored Jul 2, 2020
1 parent 7ef1f83 commit 5b06276
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,22 @@ export const initGetLogEntryRateExamplesRoute = ({ framework, sources }: InfraBa
timing,
}),
});
} catch (e) {
const { statusCode = 500, message = 'Unknown error occurred' } = e;
} catch (error) {
if (Boom.isBoom(error)) {
throw error;
}

if (e instanceof NoLogAnalysisResultsIndexError) {
return response.notFound({ body: { message } });
if (error instanceof NoLogAnalysisResultsIndexError) {
return response.notFound({ body: { message: error.message } });
}

return response.customError({
statusCode,
body: { message },
statusCode: error.statusCode ?? 500,
body: {
message: error.message ?? 'An unexpected error occurred',
},
});
}
}
})
);
};

0 comments on commit 5b06276

Please sign in to comment.