From 0cc421d3d0a290c1585d56928e25070972643f17 Mon Sep 17 00:00:00 2001 From: David Hernandez Date: Thu, 8 Aug 2024 14:28:06 -0500 Subject: [PATCH] show correct message for limit cards --- package-lock.json | 4 ++-- package.json | 2 +- src/helpers/utils.ts | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed9325e..60b8c16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tonder.io/ionic-lite-sdk", - "version": "0.0.34-beta.2", + "version": "0.0.34-beta.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tonder.io/ionic-lite-sdk", - "version": "0.0.34-beta.2", + "version": "0.0.34-beta.3", "license": "ISC", "dependencies": { "skyflow-js": "^1.34.1", diff --git a/package.json b/package.json index a8eafa3..82ea8e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tonder.io/ionic-lite-sdk", - "version": "0.0.34-beta.2", + "version": "0.0.34-beta.3", "description": "Tonder ionic lite SDK", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/helpers/utils.ts b/src/helpers/utils.ts index 47ac733..b053b96 100644 --- a/src/helpers/utils.ts +++ b/src/helpers/utils.ts @@ -35,7 +35,6 @@ const buildErrorResponse = async ( response: Response, stack: string | undefined = undefined ): Promise => { - let body, status, message = "Error"; if (response && "json" in response) { @@ -46,10 +45,13 @@ const buildErrorResponse = async ( status = response.status.toString(); } - if (response && "text" in response) { + if (!body && response && "text" in response) { message = await response.text(); } + if(body?.detail){ + message = body.detail + } const error = new ErrorResponse({ code: status, body: body,