summaryrefslogtreecommitdiff
path: root/qpid/cpp/bindings
diff options
context:
space:
mode:
authorDarryl L. Pierce <mcpierce@apache.org>2013-10-25 17:35:47 +0000
committerDarryl L. Pierce <mcpierce@apache.org>2013-10-25 17:35:47 +0000
commit55857ed2142f0faf031cc7d38ca2c0b2c7a8bd69 (patch)
tree54619ca89ae974475bc6c85845751853bc314e14 /qpid/cpp/bindings
parentb5bd56e6eceeff2ad4eb29f0ffc544abd3846926 (diff)
downloadqpid-python-55857ed2142f0faf031cc7d38ca2c0b2c7a8bd69.tar.gz
QPID-5250: Raise all exceptions within Ruby bindings.
Created a static definition for MessagingError in Ruby, then had all thrown exceptions within the bindings extend that to maintain backwards compatibility. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1535795 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/bindings')
-rw-r--r--qpid/cpp/bindings/qpid/ruby/ChangeLog1
-rw-r--r--qpid/cpp/bindings/qpid/ruby/ruby.i89
2 files changed, 87 insertions, 3 deletions
diff --git a/qpid/cpp/bindings/qpid/ruby/ChangeLog b/qpid/cpp/bindings/qpid/ruby/ChangeLog
index f9906c2d51..5eca9644d3 100644
--- a/qpid/cpp/bindings/qpid/ruby/ChangeLog
+++ b/qpid/cpp/bindings/qpid/ruby/ChangeLog
@@ -1,5 +1,6 @@
Version 0.26:
* QPID-4834: Ruby client examples incorrectly handles '--connection-options' option
+ * QPID-5250: Wrapped all C++ exceptions as Ruby exceptions.
Version 0.24:
* No language-specific changes.
diff --git a/qpid/cpp/bindings/qpid/ruby/ruby.i b/qpid/cpp/bindings/qpid/ruby/ruby.i
index 3d686c2ddb..2a544072ad 100644
--- a/qpid/cpp/bindings/qpid/ruby/ruby.i
+++ b/qpid/cpp/bindings/qpid/ruby/ruby.i
@@ -25,12 +25,95 @@
/* Define the general-purpose exception handling */
%exception {
+
+ static VALUE eMessagingError = rb_define_class("MessagingError",
+ rb_eStandardError);
+
try {
$action
}
- catch (qpid::messaging::MessagingException& mex) {
- static VALUE merror = rb_define_class("MessagingError", rb_eStandardError);
- rb_raise(merror, mex.what());
+ catch(qpid::messaging::InvalidOptionString& error) {
+ static VALUE merror = rb_define_class("InvalidOptionString", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::KeyError& error) {
+ static VALUE merror = rb_define_class("KeyError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::LinkError& error) {
+ static VALUE merror = rb_define_class("LinkError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::AddressError& error) {
+ static VALUE merror = rb_define_class("AddressError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::ResolutionError& error) {
+ static VALUE merror = rb_define_class("ResolutionError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::AssertionFailed& error) {
+ static VALUE merror = rb_define_class("AssertionFailed", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::NotFound& error) {
+ static VALUE merror = rb_define_class("NotFound", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::MalformedAddress& error) {
+ static VALUE merror = rb_define_class("MalformedAddress", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::ReceiverError& error) {
+ static VALUE merror = rb_define_class("ReceiverError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::FetchError& error) {
+ static VALUE merror = rb_define_class("FetchError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::NoMessageAvailable& error) {
+ static VALUE merror = rb_define_class("NoMessageAvailable", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::SenderError& error) {
+ static VALUE merror = rb_define_class("SenderError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::SendError& error) {
+ static VALUE merror = rb_define_class("SendError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::TargetCapacityExceeded& error) {
+ static VALUE merror = rb_define_class("TargetCapacityExceeded", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::SessionError& error) {
+ static VALUE merror = rb_define_class("SessionError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::TransactionError& error) {
+ static VALUE merror = rb_define_class("TransactionError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::TransactionAborted& error) {
+ static VALUE merror = rb_define_class("TransactionAborted", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::UnauthorizedAccess& error) {
+ static VALUE merror = rb_define_class("UnauthorizedAccess", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::ConnectionError& error) {
+ static VALUE merror = rb_define_class("ConnectionError", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::TransportFailure& error) {
+ static VALUE merror = rb_define_class("TransportFailure", eMessagingError);
+ rb_raise(merror, error.what());
+ }
+ catch(qpid::messaging::MessagingException& error) {
+ rb_raise(eMessagingError, error.what());
}
}