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 2013/03/01 11:23:31 UTC
[2/3] git commit: Core: Added one error view to handle all error
states
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 <mf...@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 <mf...@redhat.com>
Authored: Mon Jan 14 13:09:04 2013 +0100
Committer: Michal fojtik <mf...@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