Thrift: Better exception handling in Ruby.
authorDavid Reiss <dreiss@apache.org>
Fri, 25 Jan 2008 20:12:26 +0000 (20:12 +0000)
committerDavid Reiss <dreiss@apache.org>
Fri, 25 Jan 2008 20:12:26 +0000 (20:12 +0000)
Reviewed By: mcslee

Test Plan: None.

Revert Plan: ok

Other Notes:
Submitted by William Morgan.
Approved by Kevin Clark.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665442 13f79535-47bb-0310-9956-ffa450edef68

lib/rb/lib/thrift/server/tserver.rb

index 6bfc1e0..0a213c7 100644 (file)
@@ -41,10 +41,11 @@ class TSimpleServer < TServer
         while (true)
           @processor.process(prot, prot)
         end
-      rescue TTransportException => ttx
+      rescue TTransportException, TProtocolException => ttx
         print ttx,"\n"
+      ensure
+        trans.close()
       end
-      trans.close()
     end
   end