From 1e5d143d0cf6f78f04f036d1bd7df437afebad3a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 20 May 2021 16:16:06 +0200 Subject: [PATCH] [Backport 7.x] Update body error check (#1474) Co-authored-by: Tomas Della Vedova --- lib/errors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/errors.js b/lib/errors.js index cf2f296d8..a62d45936 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -90,7 +90,7 @@ class ResponseError extends ElasticsearchClientError { super('Response Error') Error.captureStackTrace(this, ResponseError) this.name = 'ResponseError' - if (meta.body && meta.body.error && meta.body.status) { + if (meta.body && meta.body.error && meta.body.error.type) { if (Array.isArray(meta.body.error.root_cause)) { this.message = meta.body.error.type + ': ' this.message += meta.body.error.root_cause.map(entry => `[${entry.type}] Reason: ${entry.reason}`).join('; ')