Try not capturing an Net:HTTP#post error

Hi

I have a very tiny wrapper around a internal tool, communicating via HTTP

def post(url:)                                                                  
  payload = { url: url }.to_json                                               
                                                                               
  Try do                                                                        
    uri = URI(settings.url)                                
    client = Net::HTTP.new(uri.host, uri.port).tap do |http|                    
      http.use_ssl = true                                                      
      http.read_timeout = 1 # in seconds                                       
      http.open_timeout = 1                                              
      http.write_timeout = 1                                                                                                                            
    end
                                                                                                                                             
    client.post('/v1/link', payload, HEADERS)                                  
  end.to_result
end 

It works fine in the specs where I do simulate the timeout either via webmock or using rspec spies, but in production the Try block seems like not working according to Sentry:

something I noticed is the description:

Crashed in non-app:

net/protocol.rb in rbuf_fill

is there something I can do about it?

I’m having difficulty reproducing this. Are you able to write a minimal repro?

irb(main):004> Dry::Monads::Try { raise Net::ReadTimeout }.to_result
=> Failure(#<Net::ReadTimeout: Net::ReadTimeout>)

No, I’m not able to reproduce it

All my test just pass, I tried what you did, making webmock to raise the error, and nothing else seems to catch it. Also tried overwriting Net::HTTP#post and still good:

```

Net::HTTP.prepend(Module.new { def post(*) = raise(Net::ReadTimeout) })

Theclass.new.call(url: 'https://example.com')
# => Failure(#<Net::ReadTimeout: Net::ReadTimeout>)