]> projects.mako.cc - selectricity/commitdiff
Add a fix for a NoMethodError when WHOIS/DNS server(s) time out.
authorJohn Dong <jdong@mit.edu>
Tue, 21 Aug 2007 17:49:04 +0000 (13:49 -0400)
committerJohn Dong <jdong@mit.edu>
Tue, 21 Aug 2007 17:49:04 +0000 (13:49 -0400)
app/views/quickvote/results.rhtml

index 2999e6b1bd1d150925387911221b77631503f841..6c1130f5e56b560ecd03989baf9b6b69406bce72 100644 (file)
@@ -158,7 +158,7 @@ by several other names.</p>
     <td><% begin %>
         <% raise ArgumentError.new, "Local Server" if voter.ipaddress == "127.0.0.1" %>
         <% raise ArgumentError.new, "XML-RPC Voter" if voter.ipaddress == "XMLRPC Request" %>
-        <% w= Whois::Whois.new(IPAddr.new(voter.ipaddress).to_s,true)%>
+        <% w= Whois::Whois.new(IPAddr.new(voter.ipaddress),true)%>
         <%=h((w.host == nil or w.host.empty?) ? voter.ipaddress : w.host)%>
       </td>
       <td>
@@ -169,6 +169,10 @@ by several other names.</p>
       <%=h err %>
     </td>
     <td><%=h err%>
+    <% rescue NoMethodError %>
+      DNS Unreachable
+    </td>
+    <td> DNS Unreachable
     <% end %>
     </td>
   <td><%= voter.vote.votestring %></td>

Benjamin Mako Hill || Want to submit a patch?