You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2015/05/14 22:24:08 UTC
[31/34] qpid-proton git commit: PROTON-799: Adjusted the Ruby error
macro
PROTON-799: Adjusted the Ruby error macro
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/7073e89b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/7073e89b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/7073e89b
Branch: refs/heads/ruby-engine-apis
Commit: 7073e89bd864f2a5c81789cf0036154845947528
Parents: cf20929
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Feb 19 14:28:54 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu May 14 15:57:10 2015 -0400
----------------------------------------------------------------------
proton-c/bindings/ruby/lib/util/error_handler.rb | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7073e89b/proton-c/bindings/ruby/lib/util/error_handler.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/util/error_handler.rb b/proton-c/bindings/ruby/lib/util/error_handler.rb
index 2f43609..da51214 100644
--- a/proton-c/bindings/ruby/lib/util/error_handler.rb
+++ b/proton-c/bindings/ruby/lib/util/error_handler.rb
@@ -41,7 +41,9 @@ module Qpid::Proton::Util
end
end
- def can_raise_error(method_names, error_class = nil)
+ def can_raise_error(method_names, options = {})
+ error_class = options[:error_class]
+ below = options[:below] || 0
# coerce the names to be an array
Array(method_names).each do |method_name|
# if the method doesn't already exist then queue this aliasing
@@ -49,12 +51,12 @@ module Qpid::Proton::Util
@@to_be_wrapped ||= []
@@to_be_wrapped << method_name
else
- create_exception_handler_wrapper(method_name, error_class)
+ create_exception_handler_wrapper(method_name, error_class, below)
end
end
end
- def create_exception_handler_wrapper(method_name, error_class = nil)
+ def create_exception_handler_wrapper(method_name, error_class = nil, below = 0)
original_method_name = method_name.to_s
wrapped_method_name = "_excwrap_#{original_method_name}"
alias_method wrapped_method_name, original_method_name
@@ -63,7 +65,8 @@ module Qpid::Proton::Util
# calls to Class.send interfere with Messenger.send
method = self.method(wrapped_method_name.to_sym)
rc = method.call(*args, &block)
- check_for_error(rc, error_class)
+ check_for_error(rc, error_class) if rc < below
+ return rc
end
end
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org