From 7ae9c3439b5165aedf85fec2f3037fc623eddc9d Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 2 Jun 2010 21:21:38 +0000 Subject: Fix error string for invalid options, fix exception handling in qpid_send/qpid_receive. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@950763 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/qpid_send.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'cpp/src/tests/qpid_send.cpp') diff --git a/cpp/src/tests/qpid_send.cpp b/cpp/src/tests/qpid_send.cpp index 7fef57a966..98d7cd60aa 100644 --- a/cpp/src/tests/qpid_send.cpp +++ b/cpp/src/tests/qpid_send.cpp @@ -247,10 +247,11 @@ class MapContentGenerator : public ContentGenerator { int main(int argc, char ** argv) { + Connection connection; Options opts; - if (opts.parse(argc, argv)) { - Connection connection(opts.url, opts.connectionOptions); - try { + try { + if (opts.parse(argc, argv)) { + connection = Connection(opts.url, opts.connectionOptions); connection.open(); std::auto_ptr updates(opts.failoverUpdates ? new FailoverUpdates(connection) : 0); Session session = opts.tx ? connection.createTransactionalSession() : connection.createSession(); @@ -327,10 +328,10 @@ int main(int argc, char ** argv) session.close(); connection.close(); return 0; - } catch(const std::exception& error) { - std::cout << "Failed: " << error.what() << std::endl; - connection.close(); } + } catch(const std::exception& error) { + std::cout << "Failed: " << error.what() << std::endl; + connection.close(); + return 1; } - return 1; } -- cgit v1.2.1