fix(xen-api/{get,put}Resource): add sync stack traces support

Follows 857a9f3ef
This commit is contained in:
Julien Fontanet 2022-08-25 16:46:25 +02:00
parent 826de17111
commit c1846e6ff3
2 changed files with 55 additions and 50 deletions

View File

@ -34,6 +34,7 @@
- @xen-orchestra/fs major
- @xen-orchestra/proxy minor
- vhd-lib major
- xen-api patch
- xo-vmdk-to-vhd patch
- xo-server minor
- xo-web patch

View File

@ -388,7 +388,8 @@ export class Xapi extends EventEmitter {
url.search = new URLSearchParams(query)
await this._setHostAddressInUrl(url, host)
const response = await pRetry(
const response = await this._addSyncStackTrace(
pRetry(
async () =>
httpRequest($cancelToken, url.href, {
rejectUnauthorized: !this._allowUnauthorized,
@ -414,6 +415,7 @@ export class Xapi extends EventEmitter {
},
}
)
)
if (pTaskResult !== undefined) {
response.task = pTaskResult
@ -480,7 +482,8 @@ export class Xapi extends EventEmitter {
// if body is a stream, sends a dummy request to probe for a redirection
// before consuming body
const response = await (isStream
const response = await this._addSyncStackTrace(
isStream
? doRequest(url.href, {
body: '',
@ -513,7 +516,8 @@ export class Xapi extends EventEmitter {
throw error
}
)
: doRequest(url.href))
: doRequest(url.href)
)
if (pTaskResult !== undefined) {
pTaskResult = pTaskResult.catch(error => {