I have a test that gets an ETIMEDOUT
error. I want to know which URL is giving the timeout. I have the following hook already
function logIfError(requestParams, response, context, ee, next) {
if (response.statusCode !== 200 && response.statusCode !== 204) {
console.error("%i %s", response.statusCode, response.url);
if (response.statusCode >= 500) {
console.log(response.headers['X-Trace-Id'])
}
if (response.statusCode >= 400) {
console.log(response.rawBody.toString())
}
}
next();
}
I added to my scenario
scenarios:
- name: My Scenario
afterResponse: logIfError
But I can't see any messages when it times out. There's a note in https://github.com/artilleryio/artillery/issues/437#issuecomment-371801777 that indicates an onError
but it is not documented anywhere.
I tried to add it in like this
scenarios:
- name: My Scenario
afterResponse: logIfError
onError: myOnErrorHandler
With my implementation as
function myOnErrorHandler(err, requestParams, context, events, callback) {
console.log("ERR", err);
return callback();
}
But again no output