From 0be68389093f69ce82ee9447c9edd656c0b72553 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 23 Aug 2015 23:06:21 +0200 Subject: [PATCH] Small improvements. --- lib/email_helper/probe.rb | 5 +++-- lib/email_helper/verify.rb | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/email_helper/probe.rb b/lib/email_helper/probe.rb index 4bfd14ed8..163d88831 100644 --- a/lib/email_helper/probe.rb +++ b/lib/email_helper/probe.rb @@ -72,11 +72,11 @@ returns on fail # probe inbound result = EmailHelper::Probe.inbound(settings[:inbound]) - next if result[:result] != 'ok' + return result if result[:result] != 'ok' # probe outbound result = EmailHelper::Probe.outbound(settings[:outbound], params[:email]) - next if result[:result] != 'ok' + return result if result[:result] != 'ok' result = { result: 'ok', @@ -365,6 +365,7 @@ returns on fail 'Lookup failed' => 'Authentication failed, username incorrect!', 'Invalid credentials' => 'Authentication failed, invalid credentials!', 'getaddrinfo: nodename nor servname provided, or not known' => 'Hostname not found!', + 'getaddrinfo: Name or service not known' => 'Hostname not found!', 'No route to host' => 'No route to host!', 'execution expired' => 'Host not reachable!', 'Connection refused' => 'Connection refused!', diff --git a/lib/email_helper/verify.rb b/lib/email_helper/verify.rb index edcefb013..28d99fcc7 100644 --- a/lib/email_helper/verify.rb +++ b/lib/email_helper/verify.rb @@ -77,12 +77,12 @@ or found = Channel::Pop3.new.fetch( { options: params[:inbound][:options] }, 'verify', subject ) end rescue => e - render json: { + rresult { result: 'invalid', message: e.to_s, subject: subject, } - return + return result end next if !found