feat(xen-api): add call params to errors (#3679)

It also moves `.method` to `.call.method`, but it appears it was not currently used in our code.
This commit is contained in:
Julien Fontanet
2018-11-13 12:03:05 +01:00
committed by Pierre Donias
parent c8da9fec0a
commit f8fbb6b7d3
3 changed files with 24 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ import {
} from 'promise-toolbox'
import autoTransport from './transports/auto'
import replaceSensitiveValues from './_replaceSensitiveValues'
const debug = createDebug('xen-api')
@@ -93,7 +94,7 @@ class XapiError extends BaseError {
this.params = params
// slots than can be assigned later
this.method = undefined
this.call = undefined
this.url = undefined
this.task = undefined
}
@@ -1071,7 +1072,10 @@ Xapi.prototype._transportCall = reduce(
error = wrapError(error)
}
error.method = method
error.call = {
method,
params: replaceSensitiveValues(args, '* obfuscated *'),
}
throw error
})
},