chore(xo-server): log ids on xapiObjectToXo errors

This commit is contained in:
Julien Fontanet 2021-07-27 14:51:10 +02:00
parent c82f860334
commit 4b4bea5f3b

View File

@ -1,4 +1,5 @@
import findKey from 'lodash/findKey.js'
import pick from 'lodash/pick'
import { BaseError } from 'make-error'
import { createLogger } from '@xen-orchestra/log'
import { fibonacci } from 'iterable-backoff'
@ -229,7 +230,11 @@ export default class {
// otherwise there will be too many logs, some of them irrelevant (transient
// and simply due to the order objects are processed)
if (xapiId in toRetry) {
log.error('xapiObjectToXo', { error })
const { $pool, $ref, $type, uuid } = xapiObject
log.error('xapiObjectToXo', {
error,
xapiObject: { $pool: pick($pool, ['$ref', 'uuid']), $ref, $type, uuid },
})
}
toRetry[xapiId] = xapiObject