[Ovirt-devel] [PATCH client 05/11] Simple helper to format an error message

David Lutterkort lutter at redhat.com
Mon Jan 26 21:20:35 UTC 2009


---
 lib/ovirt.rb |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/lib/ovirt.rb b/lib/ovirt.rb
index ce51e66..5ce64d5 100644
--- a/lib/ovirt.rb
+++ b/lib/ovirt.rb
@@ -136,4 +136,14 @@ module OVirt
       HardwarePool.find(hardware_pool_id)
     end
   end
+
+  def self.format_remote_exception(msg, e)
+    err = Hash.from_xml(e.response.body)["error"]
+    unless err.nil?
+      "#{msg}: #{err}"
+    else
+      msg
+    end
+  end
+
 end
-- 
1.6.0.6




More information about the ovirt-devel mailing list