# How to skip next successive exec if one of previous exec fails

**URL:** <https://community.gatling.io/t/how-to-skip-next-successive-exec-if-one-of-previous-exec-fails/7135>\
**Category:** Gatling (Open-Source)\
**Created:** [September 8, 2022, 11:28am UTC](https://community.gatling.io/t/how-to-skip-next-successive-exec-if-one-of-previous-exec-fails/7135 "2022-09-08T11:28:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasadkkl](https://avatars.discourse-cdn.com/v4/letter/p/ee7513/32.png) [@prasadkkl](https://community.gatling.io/u/prasadkkl)\
**Post date:** [September 8, 2022, 11:28am UTC](https://community.gatling.io/t/how-to-skip-next-successive-exec-if-one-of-previous-exec-fails/7135/1 "2022-09-08T11:28:34Z")

</div>

Scenario:

using gatling version: 3.0.0

I have 4 http requests sequentially executing using exec.But if any one of http request fails ( Eg: response code 500) successive http request should not be executed or skipped. Also corresponding user execution/simulation should be stopped.

Below is the sample code for 10 parallel users.

```scala
class Reverse extends Simulation {

val scn20 = scenario("RESERVE Senario")
              .repeat(50){ 
               feed(testfile_R)
              .exec(http("CreateEP1") // Fist API
              .post("/xpon/v1/endpoint1")
              .headers(headers_10)
              .body(ElFileBody("payload1.json")).asJson
              .check(status.is(200))
              .exec(http("CreateEP2") // Second API
              .post("/xpon/v1/endpoint2")
              .headers(headers_10)
              .body(ElFileBody("payload2.json")).asJson
              .check(status.is(200)))
              .exec(http("CreateEP3") // Third API
              .post("/xpon/v1/endpoint4")
              .headers(headers_10)
              .body(ElFileBody("payload3.json")).asJson
              .check(status.is(200)))
              .exec(http("CreateEP3") // Fourth API
              .post("/xpon/v1/endpoint4")
              .headers(headers_10)
              .body(ElFileBody("payload4.json")).asJson
              .check(status.is(200)))
             }
			 
    setUp(scn20.inject(atOnceUsers(10)).protocols(httpProtocol)) 
 }

```

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [September 8, 2022, 1:10pm UTC](https://community.gatling.io/t/how-to-skip-next-successive-exec-if-one-of-previous-exec-fails/7135/2 "2022-09-08T13:10:49Z")

</div>

> using gatling version: 3.0.0

You’re using a version from 4 years ago! You really should upgrade. The current version is 3.8.3.

You’re looking for `exitblockonfail`: [Gatling - Scenario](https://gatling.io/docs/gatling/reference/current/core/scenario/#exitblockonfail)
