From 327f1ef0f63a9b1621ef60dd91bf24537a6e361d Mon Sep 17 00:00:00 2001 From: George Smith <30024146+gwinchesters@users.noreply.github.com> Date: Wed, 13 Sep 2023 10:44:20 -0400 Subject: [PATCH] fix: corrected how nionic errors are caught and passed through (#336) * fix: corrected how nionic errors are caught and passed through * fix: stringify errors list as error message for nionic module --- src/nionic/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nionic/index.js b/src/nionic/index.js index 3a8cac08..9235ad8a 100644 --- a/src/nionic/index.js +++ b/src/nionic/index.js @@ -39,8 +39,8 @@ class Nionic { const tenantId = this._getTenantId(orgOrTenantId); const url = `${this._baseUrl.replace('', tenantId)}/graphql`; return this._request.post(url, options).then((resp) => { - if (resp.data && resp.data.errors) { - return Promise.reject(Error(resp.data.errors)); + if (resp.errors) { + return Promise.reject(Error(JSON.stringify(resp.errors))); } return Promise.resolve(resp.data); });