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

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs