Execution stops once exception is encountered

Discussion in 'Ruby' started by Vishwanath Uppala, Oct 13, 2007.

  1. 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
    --
    Posted via http://www.ruby-forum.com/.
     
    Vishwanath Uppala, Oct 13, 2007
    #1
    1. Advertising

  2. Vishwanath Uppala

    Brian Adkins Guest

    On Oct 13, 1:03 am, Vishwanath Uppala <>
    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/
     
    Brian Adkins, Oct 13, 2007
    #2
    1. Advertising

  3. 2007/10/12, Vishwanath Uppala <>:
    > 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



    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

    --
    Gerardo Santana
     
    Gerardo Santana Gómez Garrido, Oct 13, 2007
    #3
  4. Vishwanath Uppala

    Eric Hodel Guest

    On Oct 12, 2007, at 22:10 , Brian Adkins wrote:
    > On Oct 13, 1:03 am, Vishwanath Uppala <>
    > 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/


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

    --
    Poor workers blame their tools. Good workers build better tools. The
    best workers get their tools to do the work for them. -- Syndicate Wars
     
    Eric Hodel, Oct 13, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Durairaj Avasi
    Replies:
    1
    Views:
    1,027
    Slackware
    Apr 7, 2004
  2. Vinod I
    Replies:
    3
    Views:
    437
    Kelly Leahy
    Jan 16, 2004
  3. Mauricio Gonzales

    Execution stops once exception is fired

    Mauricio Gonzales, Jan 8, 2008, in forum: Ruby
    Replies:
    5
    Views:
    95
    Wirianto Djunaidi
    Jan 10, 2008
  4. Jim
    Replies:
    2
    Views:
    60
    Michael P. Broida
    Jul 19, 2003
  5. Gancy
    Replies:
    4
    Views:
    187
    Rasto Levrinc
    Feb 3, 2005
Loading...

Share This Page