Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2313410158 for ; Wed, 26 Nov 2014 20:05:49 +0000 (UTC) Received: (qmail 4948 invoked by uid 500); 26 Nov 2014 20:05:49 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 4885 invoked by uid 500); 26 Nov 2014 20:05:49 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 4796 invoked by uid 99); 26 Nov 2014 20:05:49 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Nov 2014 20:05:49 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9CCA48AF7CC; Wed, 26 Nov 2014 20:05:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gsim@apache.org To: commits@qpid.apache.org Date: Wed, 26 Nov 2014 20:05:54 -0000 Message-Id: <357cfafe4dd2409994f898cfc4d6e493@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [07/35] qpid-proton git commit: PROTON-743: Provide a means to clear errors in a Ruby Messenger. 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 Authored: Mon Nov 17 16:04:40 2014 -0500 Committer: Darryl L. Pierce 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