summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-08-01 16:06:30 +0000
committerGordon Sim <gsim@apache.org>2011-08-01 16:06:30 +0000
commit91a104cfe511c4448a6aaaed6308632d912e9594 (patch)
tree7e77ae5f13805cb7c14f2bf2b7e7f36318aa48a3 /cpp/src
parentdbaedebe0bd8cbf041727be0aeae7a27bf8961f3 (diff)
downloadqpid-python-91a104cfe511c4448a6aaaed6308632d912e9594.tar.gz
QPID-3382: Corrected some exception types for connect errors
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1152853 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/client/ConnectionHandler.cpp4
-rw-r--r--cpp/src/qpid/client/ConnectionImpl.cpp2
-rw-r--r--cpp/src/qpid/client/SslConnector.cpp2
-rw-r--r--cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp5
4 files changed, 6 insertions, 7 deletions
diff --git a/cpp/src/qpid/client/ConnectionHandler.cpp b/cpp/src/qpid/client/ConnectionHandler.cpp
index 4fbf55aa60..801fe38051 100644
--- a/cpp/src/qpid/client/ConnectionHandler.cpp
+++ b/cpp/src/qpid/client/ConnectionHandler.cpp
@@ -143,7 +143,9 @@ void ConnectionHandler::outgoing(AMQFrame& frame)
void ConnectionHandler::waitForOpen()
{
waitFor(ESTABLISHED);
- if (getState() == FAILED || getState() == CLOSED) {
+ if (getState() == FAILED) {
+ throw TransportFailure(errorText);
+ } else if (getState() == CLOSED) {
throw ConnectionException(errorCode, errorText);
}
}
diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp
index 4b7aa07065..db97f1e0f4 100644
--- a/cpp/src/qpid/client/ConnectionImpl.cpp
+++ b/cpp/src/qpid/client/ConnectionImpl.cpp
@@ -265,7 +265,7 @@ void ConnectionImpl::open()
} catch (const std::exception& e) {
QPID_LOG(debug, "Failed to connect to " << protocol << ":" << host << ":" << port << " " << e.what());
connector.reset();
- throw;
+ throw TransportFailure(e.what());
}
connector->init();
diff --git a/cpp/src/qpid/client/SslConnector.cpp b/cpp/src/qpid/client/SslConnector.cpp
index f121cfb1ab..26c2335eda 100644
--- a/cpp/src/qpid/client/SslConnector.cpp
+++ b/cpp/src/qpid/client/SslConnector.cpp
@@ -197,7 +197,7 @@ void SslConnector::connect(const std::string& host, const std::string& port){
socket.connect(host, port);
} catch (const std::exception& e) {
socket.close();
- throw ConnectionException(framing::connection::CLOSE_CODE_FRAMING_ERROR, e.what());
+ throw TransportFailure(e.what());
}
identifier = str(format("[%1% %2%]") % socket.getLocalPort() % socket.getPeerAddress());
diff --git a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
index ced8cf66fd..3492938156 100644
--- a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
+++ b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
@@ -284,10 +284,7 @@ bool ConnectionImpl::tryConnect()
QPID_LOG(info, "Connected to " << *i);
mergeUrls(connection.getInitialBrokers(), l);
return resetSessions(l);
- } catch (const qpid::ConnectionException& e) {
- //TODO: need to fix timeout on
- //qpid::client::Connection::open() so that it throws
- //TransportFailure rather than a ConnectionException
+ } catch (const qpid::TransportFailure& e) {
QPID_LOG(info, "Failed to connect to " << *i << ": " << e.what());
}
}