Various Thrift fixes, including Application Exception support in Ruby, better errror messages across languages, etc.
Reviewed By: thrift
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665058 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/Thrift.py b/lib/py/src/Thrift.py
index a1ec6cc..aeca9b9 100644
--- a/lib/py/src/Thrift.py
+++ b/lib/py/src/Thrift.py
@@ -43,6 +43,7 @@
def __init__(self, message=None):
Exception.__init__(self, message)
+ self.message = message
class TApplicationException(TException):
diff --git a/lib/py/src/transport/TSocket.py b/lib/py/src/transport/TSocket.py
index 1f9c480..280d6aa 100644
--- a/lib/py/src/transport/TSocket.py
+++ b/lib/py/src/transport/TSocket.py
@@ -13,7 +13,6 @@
"""Socket implementation of TTransport base."""
-
def __init__(self, host='localhost', port=9090):
self.host = host
self.port = port
@@ -34,7 +33,7 @@
self.handle = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.handle.connect((self.host, self.port))
except socket.error, e:
- raise TTransportException(TTransportException.NOT_OPEN)
+ raise TTransportException(TTransportException.NOT_OPEN, 'Could not connect to %s:%d' % (self.host, self.port))
def close(self):
if self.handle != None:
diff --git a/lib/py/src/transport/TTransport.py b/lib/py/src/transport/TTransport.py
index b655b32..305c10b 100644
--- a/lib/py/src/transport/TTransport.py
+++ b/lib/py/src/transport/TTransport.py
@@ -14,11 +14,11 @@
"""Custom Transport Exception class"""
- UNKNOWN = 0,
- NOT_OPEN = 1,
- ALREADY_OPEN = 2,
- TIMED_OUT = 3,
- END_OF_FILE = 4,
+ UNKNOWN = 0
+ NOT_OPEN = 1
+ ALREADY_OPEN = 2
+ TIMED_OUT = 3
+ END_OF_FILE = 4
def __init__(self, type=UNKNOWN, message=None):
TException.__init__(self, message)