[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: convert axios error to taler
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: convert axios error to taler error |
Date: |
Sun, 06 Sep 2020 15:02:18 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 87749371 convert axios error to taler error
87749371 is described below
commit 87749371dd6a8ca29d812d6f58cffa5feb6ec41c
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Sun Sep 6 18:32:05 2020 +0530
convert axios error to taler error
---
.../taler-wallet-core/src/headless/NodeHttpLib.ts | 34 +++++++++++++++-------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
index 4fefb5ae..ed4e0e1e 100644
--- a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
+++ b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
@@ -26,7 +26,7 @@ import {
HttpResponse,
} from "../util/http";
import { RequestThrottler } from "../util/RequestThrottler";
-import Axios from "axios";
+import Axios, { AxiosResponse } from "axios";
import { OperationFailedError, makeErrorDetails } from "../operations/errors";
import { TalerErrorCode } from "../TalerErrorCode";
import { URL } from "../util/url";
@@ -70,16 +70,28 @@ export class NodeHttpLib implements HttpRequestLibrary {
if (typeof opt?.timeout?.d_ms === "number") {
timeout = opt.timeout.d_ms;
}
- const resp = await Axios({
- method,
- url: url,
- responseType: "text",
- headers: opt?.headers,
- validateStatus: () => true,
- transformResponse: (x) => x,
- data: body,
- timeout,
- });
+ let resp: AxiosResponse;
+ try {
+ resp = await Axios({
+ method,
+ url: url,
+ responseType: "text",
+ headers: opt?.headers,
+ validateStatus: () => true,
+ transformResponse: (x) => x,
+ data: body,
+ timeout,
+ });
+ } catch (e) {
+ throw OperationFailedError.fromCode(
+ TalerErrorCode.WALLET_NETWORK_ERROR,
+ `${e.message}`,
+ {
+ requestUrl: url,
+ requestMethod: method,
+ },
+ );
+ }
const respText = resp.data;
if (typeof respText !== "string") {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: convert axios error to taler error,
gnunet <=