You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/08/22 15:38:27 UTC

[PATCH core 3/4] Core: Print warning when ArgumentError occurs on API

From: Michal Fojtik <mf...@redhat.com>

* When the API library code capture ArgumentError when
  calling a method on backend, it retries the same method
  but without credentials. However ArgumentError often indicate
  regular error in method arguments.

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/api.rb |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/lib/deltacloud/api.rb b/server/lib/deltacloud/api.rb
index 9567023..4007572 100644
--- a/server/lib/deltacloud/api.rb
+++ b/server/lib/deltacloud/api.rb
@@ -117,7 +117,8 @@ module Deltacloud
       begin
         params = ([@credentials] + args).flatten
         backend.send(name, *params)
-      rescue ArgumentError
+      rescue ArgumentError => e
+        puts "[W] Wrong arguments for #{name}. Omitting credentials injection. (#{e.message})"
         backend.send(name, *args)
       end
     end
-- 
1.7.10.2