ref: refs/heads/master
commit fbd826698582334e4b1e360ba91f09e50f54e933
Author: Jiri Suchomel
Date: Fri Oct 2 11:47:49 2009 +0200
catch administrator module error
---
.../app/controllers/administrator_controller.rb | 6 ++++++
.../views/shared/backendexception_trap.html.erb | 2 +-
webclient/lib/error_constructor.rb | 5 ++++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/plugins/administrator/app/controllers/administrator_controller.rb b/plugins/administrator/app/controllers/administrator_controller.rb
index 6d63764..39b7720 100644
--- a/plugins/administrator/app/controllers/administrator_controller.rb
+++ b/plugins/administrator/app/controllers/administrator_controller.rb
@@ -61,6 +61,12 @@ class AdministratorController < ApplicationController
response = @administrator.save
rescue ActiveResource::ClientError => e
flash[:error] = YaST::ServiceResource.error(e)
+ logger.warn e.inspect
+ # handle backend exception here, not by generic handler:
+ rescue ActiveResource::ServerError => e
+ error = Hash.from_xml e.response.body
+ logger.warn error.inspect
+ flash[:error] = _("Error while savig administrator settings: #{error["error"]["output"]}")
end
if params.has_key? "commit"
diff --git a/webclient/app/views/shared/backendexception_trap.html.erb b/webclient/app/views/shared/backendexception_trap.html.erb
index 1fa97b6..6e643bf 100644
--- a/webclient/app/views/shared/backendexception_trap.html.erb
+++ b/webclient/app/views/shared/backendexception_trap.html.erb
@@ -1,7 +1,7 @@
<h1><%= _("This is embarrasing....") %></h1>
-<p><%= _("Problem occur on target machine.") %></p>
+<p><%= _("Problem occured on target machine.") %></p>
<h3><%= _("Problem:") %></h3>
diff --git a/webclient/lib/error_constructor.rb b/webclient/lib/error_constructor.rb
index 0876f58..5504b70 100644
--- a/webclient/lib/error_constructor.rb
+++ b/webclient/lib/error_constructor.rb
@@ -19,7 +19,10 @@ module ErrorConstructor
if error["output"]=="NOSERVERS" #special value indicates that there is no predefined ntp server
problem = _("There is no predefined ntp server at /etc/sysconfig/network/config - NETCONFIG_NTP_STATIC_SERVERS")
end
- return _("Error occure during ntp synchronization: #{problem}")
+ return _("Error occured during ntp synchronization: #{problem}")
+ when "ADMINISTRATOR_ERROR"
+ problem = error["output"]
+ return _("Error while savig administrator settings: #{problem}")
else
RAILS_DEFAULT_LOGGER.warn "Untranslated message for exception #{error["type"]}"
return error["description"]
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org