how to fail a session/chain?

Hi guys,
I have the following as part of a simulation. I want to add the code highlighted below, that will allow me to fail the check and the session, if certain conditions would happen (e.g. I need to catch a parsing exception, due to some errors on the response from the server)
What the recommended way of doing it?

.exec(http(“activateIt”)
.post(s"/$tenant/api/activateNode")
.headers(header_app_json_xml)
.body(StringBody("${activateNodeBodyString}"))
.check(
bodyString.transform(
_.map(
string => {
val json = JSONValue.parse(string).asInstanceOf[JSONObject]
var result = new JSONObject()
if ( iDontLike(json) ) Failure(“this json is full of hot air”)
//populate result here with processed values
result.toString()
}
)
).saveAs(“neededLater”)
)//check
)

Thank you,
Radu Munteanu

Hi,

You’d either have to write your own check (beware, API changed a lot lately), or use latest snapshot, because transform signature was changed to Option[X] => Validation[Option[Y]] (so that’s exactly what you’re trying to do).

Cheers,

Stéphane