qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [07/35] qpid-proton git commit: PROTON-743: Provide a means to clear errors in a Ruby Messenger.
Date Wed, 26 Nov 2014 20:05:54 GMT
PROTON-743: Provide a means to clear errors in a Ruby Messenger.

Added the clear_error method to allow clearing out the error state in a
Ruby Messenger object.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/6504db6f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/6504db6f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/6504db6f

Branch: refs/heads/examples
Commit: 6504db6fcebc33fe57eef1b5e334b32e4b14055c
Parents: b57f45d
Author: Darryl L. Pierce <mcpierce@gmail.com>
Authored: Mon Nov 17 16:04:40 2014 -0500
Committer: Darryl L. Pierce <mcpierce@gmail.com>
Committed: Mon Nov 17 16:04:40 2014 -0500

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/qpid_proton/messenger.rb |  9 +++++++++
 .../ruby/spec/qpid/proton/messenger_spec.rb         | 16 ++++++++++++++++
 2 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6504db6f/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb b/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb
index 3dca86c..2581e2b 100644
--- a/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb
+++ b/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb
@@ -179,6 +179,15 @@ module Qpid
         Cproton.pn_error_text(Cproton.pn_messenger_error(@impl))
       end
 
+      # Clears the current error state.
+      #
+      def clear_error
+        error = Cproton.pn_messenger_error(@impl)
+        unless error.nil?
+          Cproton.pn_error_clear(error)
+        end
+      end
+
       # Currently a no-op placeholder.
       # For future compatibility, do not send or recv messages
       # before starting the +Messenger+.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6504db6f/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb b/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb
index 86050ed..1b888c1 100644
--- a/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb
+++ b/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb
@@ -222,6 +222,22 @@ module Qpid
         @messenger.passive?.should_not be_true
       end
 
+      it "can clear non-existent errors with failing" do
+        expect {
+          @messenger.clear_error
+        }.to_not raise_error
+      end
+
+      it "can clear errors" do
+        begin
+          @messenger.accept # should cause an error
+        rescue; end
+
+        @messenger.error.should_not be_nil
+        @messenger.clear_error
+        @messenger.error.should be_nil
+      end
+
       describe "once started" do
 
         before (:each) do


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message