fixed potential for not passing in an error message and triggering an unhandled exception (#96413)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Jean-Louis Leysens 2021-04-08 23:45:36 +02:00 committed by GitHub
parent 9d14256383
commit 839ab6c1ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,7 @@ export const handleEsError = ({
return response.customError({
statusCode,
body: {
message: body.error?.reason,
message: body.error?.reason ?? error.message ?? 'Unknown error',
attributes: {
// The full original ES error object
error: body.error,