ref: refs/heads/master
commit 695451e7f01da29c557838c5f226864e797b6afb
Author: Duncan Mac-Vicar P
Date: Tue Oct 27 09:05:44 2009 +0100
making error handling consistent
---
.../views/patch_updates/_patch_summary.html.erb | 2 +-
.../status/app/controllers/status_controller.rb | 13 ++++---------
.../app/views/status/_status_summary.html.erb | 2 +-
.../app/controllers/application_controller.rb | 8 +++++++-
webclient/app/helpers/view_helpers/html_helper.rb | 2 +-
5 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/plugins/patch_updates/app/views/patch_updates/_patch_summary.html.erb b/plugins/patch_updates/app/views/patch_updates/_patch_summary.html.erb
index 48187f2..37e9aac 100644
--- a/plugins/patch_updates/app/views/patch_updates/_patch_summary.html.erb
+++ b/plugins/patch_updates/app/views/patch_updates/_patch_summary.html.erb
@@ -1,4 +1,4 @@
-<%= report_error(error, _("An error occured when loading patch information.")) if error %>
+<%= report_error(error, _("A problem occured when loading patch information.")) if error %>
<div class="status_patches">
<% unless patch %>
diff --git a/plugins/status/app/controllers/status_controller.rb b/plugins/status/app/controllers/status_controller.rb
index c6a2a2b..4c2d5f6 100644
--- a/plugins/status/app/controllers/status_controller.rb
+++ b/plugins/status/app/controllers/status_controller.rb
@@ -88,16 +88,11 @@ class StatusController < ApplicationController
@limits_list[:reached] = String.new
@data_group = Hash.new
status = []
- begin
- till = Time.new
- from = till - 300 #last 5 minutes
+
+ till = Time.new
+ from = till - 300 #last 5 minutes
#puts File.read(@client.find(:dummy_param, :params => { :start => from.to_i.to_s, :stop => till.to_i.to_s }))
- status = @client.find(:dummy_param, :params => { :start => from.to_i.to_s, :stop => till.to_i.to_s })
-
- rescue ActiveResource::ClientError => e
- flash[:error] = YaST::ServiceResource.error(e)
- return false
- end
+ status = @client.find(:dummy_param, :params => { :start => from.to_i.to_s, :stop => till.to_i.to_s })
create_data_map status
# puts @data_group.inspect
true
diff --git a/plugins/status/app/views/status/_status_summary.html.erb b/plugins/status/app/views/status/_status_summary.html.erb
index c12d3d7..3950e6e 100644
--- a/plugins/status/app/views/status/_status_summary.html.erb
+++ b/plugins/status/app/views/status/_status_summary.html.erb
@@ -1,4 +1,4 @@
-<%= report_error(error, _("An error occured when loading status information.")) if error %>
+<%= report_error(error, _("An problem occured when loading status information.")) if error %>
<div class="status_status">
<% unless status %>
diff --git a/webclient/app/controllers/application_controller.rb b/webclient/app/controllers/application_controller.rb
index 367d869..abd470d 100644
--- a/webclient/app/controllers/application_controller.rb
+++ b/webclient/app/controllers/application_controller.rb
@@ -45,9 +45,15 @@ class ApplicationController < ActionController::Base
logger.debug "got backend Exception"
error = Hash.from_xml e.response.body
eulaexception_trap and return if error["error"]["type"] == "EULA_NOT_ACCEPTED"
+ # construct an exception from what we have
err_msg = construct_error(error)
+ e = Exception.new
+ e.message = err_msg
+ # add the backtrace to the exception
+ #e.set_backtrace(error["error"]["backtrace"].split("\n"))
if request.xhr?
- render :status => 503, :text => err_msg
+ logger.error "Backend error during ajax request"
+ render :status => 503, :partial => "shared/exception_trap", :locals => {:error => e} and return
else
render :status => 503, :template => "shared/backendexception_trap", :locals => {:error => err_msg}
end
diff --git a/webclient/app/helpers/view_helpers/html_helper.rb b/webclient/app/helpers/view_helpers/html_helper.rb
index 350e9b7..c5657a4 100644
--- a/webclient/app/helpers/view_helpers/html_helper.rb
+++ b/webclient/app/helpers/view_helpers/html_helper.rb
@@ -137,7 +137,7 @@ module ViewHelpers::HtmlHelper
# the summary message
if message.nil?
- message = "There was a problem retrieving information from the server."
+ message = _("There was a problem retrieving information from the server.")
end
# build the html
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org