diff options
| author | Alan Conway <aconway@apache.org> | 2010-06-02 21:21:38 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2010-06-02 21:21:38 +0000 |
| commit | 7bbadfd55b56d1917c6b3f62601aedcc07ad2018 (patch) | |
| tree | 0e37da54af32e8fdc95200ae56afc1fa41a5f118 /qpid/cpp/src/tests/qpid_send.cpp | |
| parent | c1d1a1d8336beb13838c35f37d1e7e7c12ca93cc (diff) | |
| download | qpid-python-7bbadfd55b56d1917c6b3f62601aedcc07ad2018.tar.gz | |
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@950763 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/qpid_send.cpp')
| -rw-r--r-- | qpid/cpp/src/tests/qpid_send.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/qpid/cpp/src/tests/qpid_send.cpp b/qpid/cpp/src/tests/qpid_send.cpp index 7fef57a966..98d7cd60aa 100644 --- a/qpid/cpp/src/tests/qpid_send.cpp +++ b/qpid/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<FailoverUpdates> 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; } |
