title: Rerunning failed cucumber immediately for a particular exception (ruby)
body: <p>Background:</p>
  
  <p>We run our cucumber through Jenkins on a Windows VM. We frequently get the following exception (Maybe twice a day, while the suite runs 5 or 6 times):</p>
  
  <pre><code>No connection could be made because the target machine actively refused it. - connect(2)  (Errno::ECONNREFUSED)
  </code></pre>
  
  <p>There is no consistency to this exception. It can and has struck on any step, on any line of code. I do occasionally (though much more rarely) get it locally as well. Cucumber loses all ability to interact with the browser, and all tests afterwards fail. </p>
  
  <p>Within this code</p>
  
  <pre><code>After do |scenario|
    if scenario.failed?
  </code></pre>
  
  <p>I want to check if I get that particular exception. If I do, I will kill the chrome browser with a system call, and start it up again (easy part). However, I would like to re-run the scenario that just failed, and then continue on with the rest of the suite. Is this possible? </p>
  
  <p>Side Note: I know the browser is not closed for two reasons. 1. Locally I can see it. 2. trying to start the tests off again results in a failure on the VM, because Chrome is stuck open. The VM is not down. And remember, this occasionally happens locally as well. I have spent a few hours googling for solutions to this problem, and I have found none that work for us. </p>
  
  <p>Versions:</p>
  
  <pre><code>Cucumber 1.3.8
  ruby 1.9.2
  chromedriver 2.4 
  chrome 29 (We run tests against a javascript environment that uses GWT, which often breaks with new chrome releases)
  </code></pre>
  
  <p>Thanks in advance!</p>