email_verifier icon indicating copy to clipboard operation
email_verifier copied to clipboard

Expose cause for EmailVerifier::OutOfMailServersException

Open g0ody opened this issue 9 years ago • 2 comments

We needed the internal reason why EmailVerifier::OutOfMailServersException was caused. If retry is used rubies nested exceptions do not work.

begin
  EmailVerifier.check(email)
rescue EmailVerifier::OutOfMailServersException => e
  p e.cause
end

g0ody avatar Mar 24 '16 09:03 g0ody

Hey @g0ody, we're having some issues, since we are receiving this exception for emails that are actually valid. Can you explain how your change affects the behaviour of the gem?

adamof avatar Feb 03 '17 07:02 adamof

Before it raise the EmailVerifier::OutOfMailServersException when servers are nil. This was caused by the retry. But this way you use the cause EmailVerifier::OutOfMailServersException, that is provided by ruby automatically if you raise an exception in a rescue function.

So I restructure the call so that the exception is raised in the rescue function, to be able to access the original execption when EmailVerifier::OutOfMailServersException is raised.

Other than that the behaviour stays the same.

g0ody avatar Feb 06 '17 12:02 g0ody