From: Kevin Clark Date: Wed, 18 Jun 2008 01:11:52 +0000 (+0000) Subject: Fix exception handling inside Socket#read X-Git-Tag: 0.2.0~577 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=da5d34602a17bf8f790e6878d0b133d19058a9c3;p=common%2Fthrift.git Fix exception handling inside Socket#read Also remove the useless shebang git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668973 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/rb/lib/thrift/transport/socket.rb b/lib/rb/lib/thrift/transport/socket.rb index 317d62b5..88fed904 100644 --- a/lib/rb/lib/thrift/transport/socket.rb +++ b/lib/rb/lib/thrift/transport/socket.rb @@ -1,5 +1,3 @@ -#!/usr/bin/env ruby -# # Copyright (c) 2006- Facebook # Distributed under the Thrift Software License # @@ -46,13 +44,13 @@ module Thrift def read(sz) begin data = @handle.recv(sz) - if (data.length == 0) - raise TransportException.new("Socket: Could not read #{sz} bytes from #{@host}:#{@port}") - end - return data rescue StandardError raise TransportException.new(TransportException::NOT_OPEN) end + if (data.length == 0) + raise TransportException.new(TransportException::UNKNOWN, "Socket: Could not read #{sz} bytes from #{@host}:#{@port}") + end + return data end def close