From 70df9f9535195b845e29a45a95a07a3b3262a52e Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 13 Jun 2007 18:46:29 +0000 Subject: Examples update, exception handling. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@546995 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/examples/create_queue.cpp | 2 +- cpp/examples/topic_listener.cpp | 4 +++- cpp/examples/topic_publisher.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'cpp/examples') diff --git a/cpp/examples/create_queue.cpp b/cpp/examples/create_queue.cpp index e30f40c1f6..7d08873246 100644 --- a/cpp/examples/create_queue.cpp +++ b/cpp/examples/create_queue.cpp @@ -73,7 +73,7 @@ int main() { channel.close(); connection.close(); return 0; - } catch(qpid::QpidError error) { + } catch(const std::exception& error) { std::cout << error.what() << std::endl; } return 1; diff --git a/cpp/examples/topic_listener.cpp b/cpp/examples/topic_listener.cpp index 3ad32a46cc..a5de89a736 100644 --- a/cpp/examples/topic_listener.cpp +++ b/cpp/examples/topic_listener.cpp @@ -65,6 +65,7 @@ int main() { Connection connection; Channel channel; Message msg; + cout << "Hello" << endl; try { connection.open("127.0.0.1", 5672, "guest", "guest", "/test"); connection.openChannel(channel); @@ -85,9 +86,10 @@ int main() { channel.close(); connection.close(); return 0; - } catch(std::exception error) { + } catch(const std::exception& error) { cout << "Unexpected exception: " << error.what() << endl; } + connection.close(); return 1; } diff --git a/cpp/examples/topic_publisher.cpp b/cpp/examples/topic_publisher.cpp index ecf5d51f2b..d3e1ea20b3 100644 --- a/cpp/examples/topic_publisher.cpp +++ b/cpp/examples/topic_publisher.cpp @@ -73,7 +73,7 @@ int main() { channel.close(); connection.close(); return 0; - } catch(qpid::QpidError error) { + } catch(const std::exception& error) { std::cout << error.what() << std::endl; } return 1; -- cgit v1.2.1