# Execution stops once exception is encountered

**URL:** <https://www.ruby-forum.com/t/execution-stops-once-exception-is-encountered/117120>\
**Category:** Ruby\
**Created:** [October 13, 2007, 7:03am UTC](https://www.ruby-forum.com/t/execution-stops-once-exception-is-encountered/117120 "2007-10-13T07:03:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishwanath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/0ea827/32.png) [@vishwanath](https://www.ruby-forum.com/u/vishwanath)\
**Post date:** [October 13, 2007, 7:03am UTC](https://www.ruby-forum.com/t/execution-stops-once-exception-is-encountered/117120/1 "2007-10-13T07:03:41Z")

</div>

Hi all,

I am using ruby and watir to test my web application.  
I wanna run watir script 24 x 7 without stopping.  
The problem is that the ruby stops execution each time  
it encounters an exception for e.g if it fails to locate  
a frame on a web page it gives out exception and stops executing.

Is there any way by which i can continue execution of the script  
even after encountering exceptions.

Thanking you in advance

Regards  
vishwanath

---

<div class="post-metadata">

**Author:** ![vishwanath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/0ea827/32.png) [@vishwanath](https://www.ruby-forum.com/u/vishwanath)\
**Post date:** [October 13, 2007, 7:10am UTC](https://www.ruby-forum.com/t/execution-stops-once-exception-is-encountered/117120/2 "2007-10-13T07:10:53Z")

</div>

On Oct 13, 1:03 am, Vishwanath U. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi all,
> 
> I am using ruby and watir to test my web application.  
> I wanna run watir script 24 x 7 without stopping.

> **[Nagios - The Industry Standard In IT Infrastructure Monitoring](https://www.nagios.org/)**
>
> Nagios provides enterprise-class Open Source IT monitoring, network monitoring, server and applications monitoring. Download Nagios Today!

---

<div class="post-metadata">

**Author:** ![vishwanath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/0ea827/32.png) [@vishwanath](https://www.ruby-forum.com/u/vishwanath)\
**Post date:** [October 13, 2007, 7:27am UTC](https://www.ruby-forum.com/t/execution-stops-once-exception-is-encountered/117120/3 "2007-10-13T07:27:15Z")

</div>

On Oct 12, 2007, at 22:10 , Brian A. wrote:

> On Oct 13, 1:03 am, Vishwanath U. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > Hi all,
> > 
> > I am using ruby and watir to test my web application.  
> > I wanna run watir script 24 x 7 without stopping.
> 
> [http://www.nagios.org/](http://www.nagios.org/)

How does the URL for a network monitoring program help keep a script  
running?

---

<div class="post-metadata">

**Author:** ![vishwanath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/0ea827/32.png) [@vishwanath](https://www.ruby-forum.com/u/vishwanath)\
**Post date:** [October 13, 2007, 7:16am UTC](https://www.ruby-forum.com/t/execution-stops-once-exception-is-encountered/117120/4 "2007-10-13T07:16:44Z")

</div>

2007/10/12, Vishwanath U. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Thanking you in advance
> 
> Regards  
> vishwanath

Sure, you can literally rescue the offending code. Take a look at this  
example:

$ cat test.rb  
2.downto(-2) {|i|  
begin  
puts “10/#{i} == #{10/i}”  
rescue =\> e  
puts e.message  
end  
}  
$ ruby test.rb  
10/2 == 5  
10/1 == 10  
divided by 0  
10/-1 == -10  
10/-2 == -5
