How to handle both http(...).check(...) success and failure separately

I would like my Gatling code to be able to handle a check result’s success AND failure same as with Scala Try.
Currently I only see an option to have a chain continue if the check passes successfully which is not always useful.

The flow is: load an API that may reply with a “retry” message for some simulated users. I would like the check to identify the retry request and begin a retry flow over that iteration.
Maybe I am approaching this wrong, so any advice on the matter may be useful.

Regards,
Ori

Store the response information into the session, both the return code and the response itself. But ensure that no matter what it returns, it is “successful”. Next, do logic on the response, so you can branch if a retry is called for.

Awesome!
How can I add scenario specific code that would process the response on each iteration after all checks complete?

Please realize that for the flow I mentioned, I still need validate the response I get normally if the response is not a retry and fail a check if I didn’t get the expected REST API output.
That is why I originally went for a Gatling “check” as it is the common validation mechanism.

I think I found the way.
Thanks