Browse Source

Small improvements.

Martin Edenhofer 9 years ago
parent
commit
0be6838909
2 changed files with 5 additions and 4 deletions
  1. 3 2
      lib/email_helper/probe.rb
  2. 2 2
      lib/email_helper/verify.rb

+ 3 - 2
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!',

+ 2 - 2
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