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/06/03 22:31:09 UTC
[32/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/ada57d89
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ada57d89
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ada57d89
Branch: refs/heads/master
Commit: ada57d89b0a900b8e8e30e0aec08ae95e145dcf3
Parents: ff235b8
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Feb 19 14:28:54 2015 -0500
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Wed Jun 3 16:29:25 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/ada57d89/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