From e99e16c843846d13770f4f6484e5c141875748c2 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 7 Feb 2024 16:46:03 +0100 Subject: [PATCH] Error handling --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 37c7396e..a4bf45b5 100644 --- a/index.js +++ b/index.js @@ -164,7 +164,7 @@ class Action { const json = await response.json(); if (response.status !== 200) { - throw new Error(json.error); + throw new Error(json.error.message); } const { result } = json; @@ -200,7 +200,7 @@ class Action { const json = await response.json(); if (response.status !== 201) { - throw new Error(json.error); + throw new Error(json.error.message); } const { token } = json;