|
@@ -16,7 +16,6 @@
|
|
|
# limitations under the License.
|
|
# limitations under the License.
|
|
|
#
|
|
#
|
|
|
# Utilities for Thrift
|
|
# Utilities for Thrift
|
|
|
-import desktop.lib.eventlet_util
|
|
|
|
|
|
|
|
|
|
import Queue
|
|
import Queue
|
|
|
import logging
|
|
import logging
|
|
@@ -32,9 +31,8 @@ from thrift.transport.TSocket import TSocket
|
|
|
from thrift.transport.TTransport import TBufferedTransport, TMemoryBuffer,\
|
|
from thrift.transport.TTransport import TBufferedTransport, TMemoryBuffer,\
|
|
|
TTransportException
|
|
TTransportException
|
|
|
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
|
|
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
|
|
|
-from desktop.lib.exceptions import StructuredThriftTransportException
|
|
|
|
|
from desktop.lib.thrift_sasl import TSaslClientTransport
|
|
from desktop.lib.thrift_sasl import TSaslClientTransport
|
|
|
-import desktop.lib.exceptions as exceptions
|
|
|
|
|
|
|
+from desktop.lib.exceptions import StructuredException, StructuredThriftTransportException
|
|
|
|
|
|
|
|
# The maximum depth that we will recurse through a "jsonable" structure
|
|
# The maximum depth that we will recurse through a "jsonable" structure
|
|
|
# while converting to thrift. This prevents us from infinite recursion
|
|
# while converting to thrift. This prevents us from infinite recursion
|
|
@@ -286,13 +284,13 @@ class PooledClient(object):
|
|
|
except TApplicationException, e:
|
|
except TApplicationException, e:
|
|
|
# Unknown thrift exception... typically IO errors
|
|
# Unknown thrift exception... typically IO errors
|
|
|
logging.info("Thrift saw an application exception: " + str(e), exc_info=False)
|
|
logging.info("Thrift saw an application exception: " + str(e), exc_info=False)
|
|
|
- raise exceptions.StructuredException('THRIFTAPPLICATION', str(e), data=None, error_code=502)
|
|
|
|
|
|
|
+ raise StructuredException('THRIFTAPPLICATION', str(e), data=None, error_code=502)
|
|
|
except socket.error, e:
|
|
except socket.error, e:
|
|
|
logging.info("Thrift saw a socket error: " + str(e), exc_info=False)
|
|
logging.info("Thrift saw a socket error: " + str(e), exc_info=False)
|
|
|
- raise exceptions.StructuredException('THRIFTSOCKET', str(e), data=None, error_code=502)
|
|
|
|
|
|
|
+ raise StructuredException('THRIFTSOCKET', str(e), data=None, error_code=502)
|
|
|
except TTransportException, e:
|
|
except TTransportException, e:
|
|
|
logging.info("Thrift saw a transport exception: " + str(e), exc_info=False)
|
|
logging.info("Thrift saw a transport exception: " + str(e), exc_info=False)
|
|
|
- raise exceptions.StructuredThriftTransportException(e, error_code=502)
|
|
|
|
|
|
|
+ raise StructuredThriftTransportException(e, error_code=502)
|
|
|
except Exception, e:
|
|
except Exception, e:
|
|
|
# Stack tends to be only noisy here.
|
|
# Stack tends to be only noisy here.
|
|
|
logging.info("Thrift saw exception: " + str(e), exc_info=False)
|
|
logging.info("Thrift saw exception: " + str(e), exc_info=False)
|