Can I catch something like Errno::EBADF with rescue?


#1

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


#2

On Tue, Apr 18, 2006 at 01:44:25AM +0200, Wes G. 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

#3

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 P. wrote:

On Tue, Apr 18, 2006 at 01:44:25AM +0200, Wes G. 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