Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

afterResponse not triggered in case of connection error #437

Closed
gerasimos opened this issue Mar 8, 2018 · 6 comments
Closed

afterResponse not triggered in case of connection error #437

gerasimos opened this issue Mar 8, 2018 · 6 comments
Labels

Comments

@gerasimos
Copy link

Hello,

I've notice that afterResponse is not triggered in case of connection errors (timeouts, invalid host etc) such as ECONNREFUSED (on the other hand, such cases are reported in the artillery output).

@hassy
Copy link
Member

hassy commented Mar 8, 2018

If a connection is refused there's no response to call the function on. :)

@gerasimos
Copy link
Author

gerasimos commented Mar 9, 2018

OK, I understand this. In any case, is there any chance to have this in a next release? Or, how else can I (custom) log such cases?

There is onError which is scenario-based and haven't figure out how to use it in the yaml file. Can something similar be applied per request?

Thank you,
Gerasimos

@hassy
Copy link
Member

hassy commented Mar 9, 2018

You can use a scenario-level onError hook with the following signature:

function myOnErrorHandler(err, requestParams, context, events, callback) {
  // ...
  return callback();
}

@hassy hassy added the docs label Mar 9, 2018
@gerasimos
Copy link
Author

Thank you, that works for my case.

@trajano
Copy link

trajano commented Feb 26, 2022

Where is this documented?

@trajano
Copy link

trajano commented Mar 3, 2022

For those who got here, I posted a solution to this in https://stackoverflow.com/questions/71273683/in-artillery-how-do-i-log-etimedout/71332728#71332728

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants