diff options
Diffstat (limited to 'packages/web-util/src/utils')
-rw-r--r-- | packages/web-util/src/utils/http-impl.sw.ts | 5 |
1 files 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 index 295681b53..3120309f4 100644 --- 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; |