# How to Exit the simulation when a scenario is failed in simulation setup.

**URL:** <https://community.gatling.io/t/how-to-exit-the-simulation-when-a-scenario-is-failed-in-simulation-setup/5777>\
**Category:** Gatling (Open-Source)\
**Created:** [August 26, 2020, 2:51am UTC](https://community.gatling.io/t/how-to-exit-the-simulation-when-a-scenario-is-failed-in-simulation-setup/5777 "2020-08-26T02:51:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghuveer\_chintoju](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@raghuveer\_chintoju](https://community.gatling.io/u/raghuveer_chintoju)\
**Post date:** [August 26, 2020, 2:51am UTC](https://community.gatling.io/t/how-to-exit-the-simulation-when-a-scenario-is-failed-in-simulation-setup/5777/1 "2020-08-26T02:51:17Z")

</div>

Hi All,

I am trying to simulate load with multiple scenarios with diff protocols that are executed sequentially.

How do I exit the simulation when scenario 1 is failed / execute scenario 2 conditionally?

Example:

val scn1 = scenario(“Http\_protocol\_scenario1”)  
.exec(dosomething)

val scn2 = scenario(“JMS\_protocol\_scenario2”)  
.exec(dosomething)

setUp(

scn1.inject(atOnceUsers(1)).protocols(httpprotocol)  
.andThen(  
scn2.inject(atOnceUsers(10)).protocols(JMSProtocol)  
)  
)

P.S: I am using the Gatling version of 3.4.0-M1 to be able to execute the scenarios sequentially.  
[https://github.com/gatling/gatling/issues/3830](https://github.com/gatling/gatling/issues/3830)

Thank you.

---

<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:** [August 26, 2020, 1:09pm UTC](https://community.gatling.io/t/how-to-exit-the-simulation-when-a-scenario-is-failed-in-simulation-setup/5777/2 "2020-08-26T13:09:57Z")

</div>

I don’t think that’s possible: even if you find a way to bypass scn2’s content depending on what happens in scn1, scn2’s injection profile will still be starting users as planned.

Note: 3.4.0-M1 was an internal milestone released for a customer. It’s definitely not a stable release and is known to be buggy. Not for public use.
