Wes Gamble
2006-Apr-17 23:44 UTC
[Rails] Can I catch something like Errno::EBADF with rescue?
All, I am using Net::HTTP to make requests for URLs in my app. When I get a bad server, I get "Bad file descriptor - connect(2)" message on a ERRNO:EBADF error. Can I catch with rescue or otherwise gracefully react to that error? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
Matthew Palmer
2006-Apr-17 23:58 UTC
[Rails] Re: Can I catch something like Errno::EBADF with rescue?
On Tue, Apr 18, 2006 at 01:44:25AM +0200, Wes Gamble wrote:> I am using Net::HTTP to make requests for URLs in my app. When I get a > bad server, I get "Bad file descriptor - connect(2)" message on a > ERRNO:EBADF error. > > Can I catch with rescue or otherwise gracefully react to that error?Of course. begin # code rescue Errno::EBADF => e # handle me, baby! end - Matt
Wes Gamble
2006-Apr-18 00:02 UTC
[Rails] Re: Can I catch something like Errno::EBADF with rescue?
I just caught it by mistake when I saw this. I was making a Java distinction between Errno and Exception - there is probably some diff. that I don''t understand yet, but this will work for now!!! Thanks, Wes Matthew Palmer wrote:> On Tue, Apr 18, 2006 at 01:44:25AM +0200, Wes Gamble wrote: >> I am using Net::HTTP to make requests for URLs in my app. When I get a >> bad server, I get "Bad file descriptor - connect(2)" message on a >> ERRNO:EBADF error. >> >> Can I catch with rescue or otherwise gracefully react to that error? > > Of course. > > begin > # code > rescue Errno::EBADF => e > # handle me, baby! > end > > - Matt-- Posted via http://www.ruby-forum.com/.