Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If connection failed lib throws Faraday::ConnectionFailed exception #20

Open
qelphybox opened this issue Jan 28, 2020 · 1 comment
Open
Labels
bug Something isn't working

Comments

@qelphybox
Copy link

Bug
If connection failed lib throws Faraday::ConnectionFailed exception. You have to rescue from Faraday::Error which is quite unobvious

To Reproduce
Steps to reproduce the behavior:

  1. Disconnect from iternet, make imposible to send request
  2. Run
begin
  Zerobounce.valid?('[email protected]')
rescue Zerobounce::Error
  puts 'catch'
end
# >> Faraday::ConnectionFailed: Failed to open TCP connection to api.zerobounce.net:443 (getaddrinfo: Temporary failure in name resolution)

Expected behavior
Zerobounce::ConnectionError Failed to open TCP connection to api.zerobounce.net:443 (getaddrinfo: Temporary failure in name resolution)

@qelphybox qelphybox added the bug Something isn't working label Jan 28, 2020
@afrase
Copy link
Owner

afrase commented Feb 25, 2020

I looked into this but it would require wrapping the #get call in a rescue and some refactoring of the base error class.
When ever I get some time I'll try to get this refactored to catch errors raised by faraday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants