[yast-commit] <web-client> backgroud_patches_bnc550934 : cleanup exception handling espl. not running collectd (bnc#555205)
ref: refs/heads/backgroud_patches_bnc550934 commit 4ab44123fb323d1dd41e6616a80c1baeeae3d4ca Author: Stefan Schubert <schubi@suse.de> Date: Thu Nov 19 11:08:47 2009 +0100 cleanup exception handling espl. not running collectd (bnc#555205) --- .../status/app/controllers/status_controller.rb | 40 ++++++++++++++----- 1 files changed, 29 insertions(+), 11 deletions(-) diff --git a/plugins/status/app/controllers/status_controller.rb b/plugins/status/app/controllers/status_controller.rb index 4936a53..ca521b8 100644 --- a/plugins/status/app/controllers/status_controller.rb +++ b/plugins/status/app/controllers/status_controller.rb @@ -154,15 +154,24 @@ class StatusController < ApplicationController def index return unless client_permissions - - log = YaST::ServiceResource.proxy_for('org.opensuse.yast.system.logs') - @logs = log.find(:all) - flash[:notice] = _("No data found for showing system status.") unless create_data - limits_reached - logger.debug "limits reached for #{@limits_list[:reached].inspect}" + begin + log = YaST::ServiceResource.proxy_for('org.opensuse.yast.system.logs') + @logs = log.find(:all) + flash[:notice] = _("No data found for showing system status.") unless create_data + limits_reached + logger.debug "limits reached for #{@limits_list[:reached].inspect}" + rescue ActiveResource::ServerError => error + error_hash = Hash.from_xml error.response.body + logger.warn error_hash.inspect + if error_hash["error"] && + (error_hash["error"]["type"] == "SERVICE_NOT_RUNNING" || error_hash["error"]["type"] == "NO_PERM") + flash[:error] = error_hash["error"]["description"] + else + raise error + end + end end - def show_summary return unless client_permissions begin @@ -173,10 +182,19 @@ class StatusController < ApplicationController status = _("No data found for showing system status.") end render :partial => "status_summary", :locals => { :status => status, :error => nil } - rescue Exception => error - erase_redirect_results #reset all redirects - erase_render_results - render :partial => "status_summary", :locals => { :status => nil, :error => ClientException.new(error) } and return + rescue ActiveResource::ClientError => error + logger.warn error.inspect + render :partial => "status_summary", :locals => { :status => nil, :error => ClientException.new(error) } and return + rescue ActiveResource::ServerError => error + error_hash = Hash.from_xml error.response.body + logger.warn error_hash.inspect + if error_hash["error"] && + (error_hash["error"]["type"] == "SERVICE_NOT_RUNNING" || error_hash["error"]["type"] == "NO_PERM") + status = error_hash["error"]["description"] + render :partial => "status_summary", :locals => { :status => status, :error => nil } + else + render :partial => "status_summary", :locals => { :status => nil, :error => ClientException.new(error) } + end end end -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Stefan Schubert