From da5d34602a17bf8f790e6878d0b133d19058a9c3 Mon Sep 17 00:00:00 2001 From: Kevin Clark Date: Wed, 18 Jun 2008 01:11:52 +0000 Subject: [PATCH] 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 --- lib/rb/lib/thrift/transport/socket.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 -- 2.17.1