summaryrefslogtreecommitdiff
path: root/cpp/src/tests/qpid_send.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-06-02 21:21:38 +0000
committerAlan Conway <aconway@apache.org>2010-06-02 21:21:38 +0000
commit7ae9c3439b5165aedf85fec2f3037fc623eddc9d (patch)
tree217affd8202df8d2101d018020150fccf8eafdbf /cpp/src/tests/qpid_send.cpp
parent82370f874e14cf7ee9d781a1902572e6bac00926 (diff)
downloadqpid-python-7ae9c3439b5165aedf85fec2f3037fc623eddc9d.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/qpid@950763 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/qpid_send.cpp')
-rw-r--r--cpp/src/tests/qpid_send.cpp15
1 files changed, 8 insertions, 7 deletions
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<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;
}