public
Fork of DrMark/ultrasphinx
Description: a maintained fork of Evan Weaver's Ultrasphinx code -- see the escape_sql branch
Homepage: http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html
Clone URL: git://github.com/github/ultrasphinx.git
Raise clearer exceptions on search failures. 


git-svn-id: svn://rubyforge.org/var/svn/fauna/ultrasphinx/trunk@1949 
c1ad287d-65d5-445d-b84c-e64f8492f1e6
evanweaver (author)
Fri May 02 11:39:04 -0700 2008
commit  a42f1fa5f52ab2820721e3704ec7df18e5d17d9e
tree    7e804f27a0cce5c0993786f59a55a863ff7e5ae6
parent  e48af87dbdec2948f3fa8aa08a582431abe9c025
...
347
348
349
 
350
351
352
353
354
355
356
357
 
358
359
360
...
362
363
364
365
 
 
 
366
367
368
...
347
348
349
350
351
352
 
 
 
 
 
 
353
354
355
356
...
358
359
360
 
361
362
363
364
365
366
0
@@ -347,14 +347,10 @@ module Ultrasphinx
0
       
0
       def perform_action_with_retries
0
         tries = 0
0
+ exceptions = [NoMethodError, Riddle::VersionError, Riddle::ResponseError, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EPIPE]
0
         begin
0
           yield
0
- rescue NoMethodError,
0
- Riddle::VersionError,
0
- Riddle::ResponseError,
0
- Errno::ECONNREFUSED,
0
- Errno::ECONNRESET,
0
- Errno::EPIPE => e
0
+ rescue *exceptions => e
0
           tries += 1
0
           if tries <= Ultrasphinx::Search.client_options['max_retries']
0
             say "restarting query (#{tries} attempts already) (#{e})"
0
@@ -362,7 +358,9 @@ module Ultrasphinx
0
             retry
0
           else
0
             say "query failed"
0
- raise DaemonError, e.to_s
0
+ # Clear the rescue list, retry one last time, and let the error fail up the stack
0
+ exceptions = []
0
+ retry
0
           end
0
         end
0
       end

Comments

    No one has commented yet.