qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcpie...@apache.org
Subject [35/35] qpid-proton git commit: PROTON-799: Adjusted the Ruby error macro
Date Tue, 19 May 2015 17:22:55 GMT
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/10bb8efc
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/10bb8efc
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/10bb8efc

Branch: refs/heads/ruby-engine-apis
Commit: 10bb8efc1daff47ef9518566bd00a4aeef889b48
Parents: ae72091
Author: Darryl L. Pierce <mcpierce@gmail.com>
Authored: Thu Feb 19 14:28:54 2015 -0500
Committer: Darryl L. Pierce <mcpierce@gmail.com>
Committed: Tue May 19 10:17:21 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/10bb8efc/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


Mime
View raw message