diff options
author | Florian Dold <florian@dold.me> | 2024-06-30 18:24:33 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-06-30 18:24:33 +0200 |
commit | 58ddc54ebc0b6671413ac119176091c74184f59b (patch) | |
tree | 3b6b1c57831a19c256bba22a77dc318d9beaa07a | |
parent | c1c1763432c61768a798bd261ac3697d2c6c6756 (diff) | |
download | wallet-core-58ddc54ebc0b6671413ac119176091c74184f59b.tar.xz |
util: qtart http logging
-rw-r--r-- | packages/taler-util/src/http-impl.qtart.ts | 15 |
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); } |