# exitHereIfFailed not working

**URL:** <https://community.gatling.io/t/exithereiffailed-not-working/3019>\
**Category:** Gatling (Open-Source)\
**Created:** [May 20, 2016, 6:52pm UTC](https://community.gatling.io/t/exithereiffailed-not-working/3019 "2016-05-20T18:52:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mac](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@Mac](https://community.gatling.io/u/Mac)\
**Post date:** [May 20, 2016, 6:52pm UTC](https://community.gatling.io/t/exithereiffailed-not-working/3019/1 "2016-05-20T18:52:18Z")

</div>

I have below two chains and both have exitHereIfFailed. I would like the session to end if a failure had to happen in either of the chains. The chain witch CHECK exits session as expected if failure had to happen but the chain without the CHECK continues and session does not end. My understanding is that Gatling has a default check for every exec() with status in (200,201,202 …etc). My exec() is returning code 500 and 503 and I see the error in the console log but the session continues. Do I need to add CHECK for every exec() for using exitHereIfFailed.This simulation is run on AWS linux box and using Gatling version 2.1.7

val **ChainwithCheck** = (

```auto
 .group("groupNAME"){
    exec(http("postRequest")
      .post("""/abc/xyz/testing"""+Common.systemtime())
      .headers(headers_3)
      .formParam("""response""", """true""")
      **.check(regex( """authenticated":true""").findAll.exists)**
 **.check(regex( """acknowledged":true""").findAll.exists)**
      .resources(http("getRquest")
        .get(uri1 + """/test?"""+Common.systemtime())
       **.check(css("""label[for='ssn']""").find.saveAs("ssnValue"))**
        .headers(headers_1),
        http("getResources")
          .get(uri1 + """/getResources"""+Common.systemtime())
          .headers(headers_2)))}
).exitHereIfFailed

val **ChainWithoutCheck** = (

 .group("groupNAME"){
    exec(http("get")
      .get("""/abc/xyz/testing"""+Common.systemtime())
      .headers(headers_3)       
      .resources(http("getRquest")
        .get(uri1 + """/test?"""+Common.systemtime())       
        .headers(headers_1),
        http("getAllResources8")
          .get(uri1 + """/getResources"""+Common.systemtime())
          .headers(headers_2)))}
).exitHereIfFailed

val scn1 = scenario("mySimulation").exec(ChainwithCheck ).exec(ChainWithoutCheck )
setUp(scn1.inject(rampUsers(numberofusers) over (rampupby)).protocols(httpProtocol))

```
