commit 4db720c081ca830db81363e9a8acfd4dddbf9120
parent 5687b0bcfbf2a13c1a2ebeee6f66577dc248d513
Author: Sebastian <sebasjm@gmail.com>
Date: Wed, 13 Dec 2023 18:07:00 -0300
better error msg
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/packages/web-util/src/utils/http-impl.sw.ts b/packages/web-util/src/utils/http-impl.sw.ts
@@ -182,6 +182,7 @@ function makeJsonHandler(
try {
responseJson = await response.json();
} catch (e) {
+ const message = e instanceof Error ? `Invalid JSON from HTTP response: ${e.message}` : "Invalid JSON from HTTP response"
throw TalerError.fromDetail(
TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
{
@@ -189,7 +190,7 @@ function makeJsonHandler(
requestMethod,
httpStatusCode: response.status,
},
- "Invalid JSON from HTTP response",
+ message,
);
}
}
@@ -201,7 +202,7 @@ function makeJsonHandler(
requestMethod,
httpStatusCode: response.status,
},
- "Invalid JSON from HTTP response",
+ "Invalid JSON from HTTP response: null or not object",
);
}
return responseJson;