Hi all,
I am using a begin.. rescue.. else block to catch a timeout and try
again until it succeeds. Despite the rescue block, the program still
crashes due to a timeout error. Don't rescue blocks catch everything?
success = false
while success == false
begin
output2 = exportForm.click_button(exportForm.buttons[3])
rescue Timeout::Error
output "Timeout.. waiting 5s then trying again"
sleep(5)
else
success = true
end
end
Thanks,
Ben
on 2010-02-07 23:33
on 2010-02-08 00:44
El Domingo, 7 de Febrero de 2010, Ben Vishny escribió: > rescue Timeout::Error > output "Timeout.. waiting 5s then trying again" > sleep(5) > else > success = true > end > end Are you sure which is the exact exception raised?
on 2010-02-08 00:46
Iñaki Baz Castillo wrote: > El Domingo, 7 de Febrero de 2010, Ben Vishny escribió: >> rescue Timeout::Error >> output "Timeout.. waiting 5s then trying again" >> sleep(5) >> else >> success = true >> end >> end > > Are you sure which is the exact exception raised? My mistake. I originally had a generic rescue clause without the Timeout::Error and it was still erroring out - I tried this to see if it would make a difference. Does the rescue clause catch everything if no error is provided?
on 2010-02-08 02:34
El Lunes, 8 de Febrero de 2010, Ben Vishny escribió: > Does the rescue clause catch everything if no > error is provided? Yes.
on 2010-02-08 02:43
Hi,
In message "Re: Rescue Block does not work"
on Mon, 8 Feb 2010 08:46:11 +0900, Ben Vishny <bvishny@gmail.com>
writes:
|Does the rescue clause catch everything if no
|error is provided?
The rescue clause without explicit exception class catches any
subclass of StandardError.
matz.
on 2010-02-08 02:44
Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Rescue Block does not work" > on Mon, 8 Feb 2010 08:46:11 +0900, Ben Vishny <bvishny@gmail.com> > writes: > > |Does the rescue clause catch everything if no > |error is provided? > > The rescue clause without explicit exception class catches any > subclass of StandardError. > > > matz. Matz, Does this mean that the rescue block doesn't work because the error I'm trying to catch isn't part of StandardError? Ben
on 2010-02-08 02:57
Hi,
In message "Re: Rescue Block does not work"
on Mon, 8 Feb 2010 10:45:27 +0900, Ben Vishny <bvishny@gmail.com>
writes:
|Does this mean that the rescue block doesn't work because the error I'm
|trying to catch isn't part of StandardError?
On 1.8, Timeout::Error is a subclass of Interrupt, which is NOT a
subclass of StandardError. Explicitly specify the error to catch the
timeout.
matz.
on 2010-02-08 03:00
Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Rescue Block does not work" > on Mon, 8 Feb 2010 10:45:27 +0900, Ben Vishny <bvishny@gmail.com> > writes: > > |Does this mean that the rescue block doesn't work because the error I'm > |trying to catch isn't part of StandardError? > > On 1.8, Timeout::Error is a subclass of Interrupt, which is NOT a > subclass of StandardError. Explicitly specify the error to catch the > timeout. > > > matz. Matz, Thanks so much! I'm using Timeout::Error now and having no problems. You wrote one kick-ass language, btw. Ben
on 2010-02-08 03:19
El Lunes, 8 de Febrero de 2010, Iñaki Baz Castillo escribió: > El Lunes, 8 de Febrero de 2010, Ben Vishny escribió: > > Does the rescue clause catch everything if no > > error is provided? > > Yes. Sorry, I was wrong as just StandardError inherit exceptions are rescued.
on 2010-02-08 06:10
Hi,
In message "Re: Rescue Block does not work"
on Mon, 8 Feb 2010 11:00:28 +0900, Ben Vishny <bvishny@gmail.com>
writes:
|Thanks so much! I'm using Timeout::Error now and having no problems. You
|wrote one kick-ass language, btw.
For the record, on 1.9 Timeout::Error is a subclass of StandardError.
matz.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.