aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-06-30 18:24:33 +0200
committerFlorian Dold <florian@dold.me>2024-06-30 18:24:33 +0200
commit58ddc54ebc0b6671413ac119176091c74184f59b (patch)
tree3b6b1c57831a19c256bba22a77dc318d9beaa07a
parentc1c1763432c61768a798bd261ac3697d2c6c6756 (diff)
downloadwallet-core-58ddc54ebc0b6671413ac119176091c74184f59b.tar.xz
util: qtart http logging
-rw-r--r--packages/taler-util/src/http-impl.qtart.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/taler-util/src/http-impl.qtart.ts b/packages/taler-util/src/http-impl.qtart.ts
index f60c82fc3..6ccd35b83 100644
--- a/packages/taler-util/src/http-impl.qtart.ts
+++ b/packages/taler-util/src/http-impl.qtart.ts
@@ -102,8 +102,8 @@ export class HttpLibImpl implements HttpRequestLibrary {
if (opt?.headers) {
Object.entries(opt?.headers).forEach(([key, value]) => {
if (value === undefined) return;
- requestHeadersMap[key] = value
- })
+ requestHeadersMap[key] = value;
+ });
}
let headersList: string[] = [];
for (let headerName of Object.keys(requestHeadersMap)) {
@@ -115,13 +115,12 @@ export class HttpLibImpl implements HttpRequestLibrary {
const cancelPromCap = openPromise<QjsHttpResp>();
+ logger.trace(`calling qtart fetchHttp`);
+
// Just like WHATWG fetch(), the qjs http client doesn't
// really support cancellation, so cancellation here just
// means that the result is ignored!
- const {
- promise: fetchProm,
- cancelFn
- } = qjsOs.fetchHttp(url, {
+ const { promise: fetchProm, cancelFn } = qjsOs.fetchHttp(url, {
method,
data,
headers: headersList,
@@ -138,6 +137,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
if (opt?.cancellationToken) {
cancelCancelledHandler = opt.cancellationToken.onCancelled(() => {
+ logger.trace(`cancelling quickjs request`);
cancelFn();
cancelPromCap.reject(new RequestCancelledError());
});
@@ -147,6 +147,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
try {
res = await Promise.race([fetchProm, cancelPromCap.promise]);
} catch (e) {
+ logger.trace(`got exception while waiting for qtart http response`);
if (e instanceof RequestCancelledError) {
throw TalerError.fromDetail(
TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,
@@ -172,6 +173,8 @@ export class HttpLibImpl implements HttpRequestLibrary {
throw e;
}
+ logger.trace(`got qtart http response, status ${res.status}`);
+
if (timeoutHandle != null) {
clearTimeout(timeoutHandle);
}