You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2012/03/13 18:28:31 UTC

[1/6] git commit: Client: Re-use server message for 40x HTTP statuses (DTACLOUD-160)

Updated Branches:
  refs/heads/master cd8f41436 -> d4076e1a5


Client: Re-use server message for 40x HTTP statuses (DTACLOUD-160)

Previously the 40x HTTP response status was dropped
and replaced by 'default' description from HTTP specification.
This patch will allow to send user-defined messages from
server. For example code 400 (Bad request) can now indicate
invalid parameters to the client.


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/858bd928
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/858bd928
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/858bd928

Branch: refs/heads/master
Commit: 858bd92826049ff4ed57e199ed3b19c0129f2308
Parents: 6bf9c34
Author: Michal Fojtik <mf...@redhat.com>
Authored: Tue Mar 13 14:31:53 2012 +0100
Committer: Michal fojtik <mf...@redhat.com>
Committed: Tue Mar 13 18:29:14 2012 +0100

----------------------------------------------------------------------
 client/lib/deltacloud.rb |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/858bd928/client/lib/deltacloud.rb
----------------------------------------------------------------------
diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index e0cb2e4..e6ae89e 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -355,10 +355,10 @@ module DeltaCloud
     end
 
     def response_error(response)
-      if response.code.to_s =~ /4(\d{2})/
+      xml = Nokogiri::XML(response.to_s)
+      if (xml/'message').empty? and response.code.to_s =~ /4(\d{2})/
         DeltaCloud::HTTPError.client_error(response.code)
       else
-        xml = Nokogiri::XML(response.to_s)
         opts = {
           :driver => (xml/'backend').first[:driver],
           :provider => (xml/'backend').first[:provider],