deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [2/3] git commit: Core: Added one error view to handle all error states
Date Fri, 01 Mar 2013 10:23:31 GMT
Core: Added one error view to handle all error states

This should fix the numerous problems we have with
maintaining large list of error views. The HAML views
for errors looks all the same, so this patch should
provide consistency across all reported errors.

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
TrackedAt: http://tracker.deltacloud.org/patch/8e499a8b524059285698907d92daf785e46e2ef6


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

Branch: refs/heads/master
Commit: 8784edc25bc6c2824da4371765a21ec742b6db3b
Parents: 5192efc
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Mon Jan 14 13:09:04 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Fri Mar 1 11:23:04 2013 +0100

----------------------------------------------------------------------
 server/lib/deltacloud/helpers/deltacloud_helper.rb |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/8784edc2/server/lib/deltacloud/helpers/deltacloud_helper.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/helpers/deltacloud_helper.rb b/server/lib/deltacloud/helpers/deltacloud_helper.rb
index 8edc5b0..af14041 100644
--- a/server/lib/deltacloud/helpers/deltacloud_helper.rb
+++ b/server/lib/deltacloud/helpers/deltacloud_helper.rb
@@ -18,6 +18,10 @@ module Deltacloud::Helpers
 
     require 'benchmark'
 
+    def current_provider
+      Thread.current[:provider] || ENV['API_PROVIDER'] || 'default'
+    end
+
     def collections_to_json(collections)
       r = {
         :version => settings.version,
@@ -124,16 +128,16 @@ module Deltacloud::Helpers
       end
 
       respond_to do |format|
-        format.xml {  haml :"errors/#{@code || @error.code}", :layout => false }
+        format.xml {  haml :"errors/common", :layout => false }
         format.json { JSON::dump({ :code => @code || @error.code, :message => message,
:error => @error.class.name }) }
         format.html {
           begin
-            haml :"errors/#{@code || @error.code}", :layout => :error
+            haml :"errors/common", :layout => :error
           rescue RuntimeError
             # If the HTML representation of error is missing, then try to report
             # it through XML
             @media_type=:xml
-            haml :"errors/#{@code || @error.code}", :layout => false
+            haml :"errors/common", :layout => false
           end
         }
       end


Mime
View raw message