ref: refs/heads/master
commit fd944a18eeadcf78583c90876d28a9ce1cfa5b0c
Author: Josef Reidinger
Date: Tue Nov 3 17:17:42 2009 +0100
report NotFoundError as backend exception if not catched bnc#548721
---
.../app/controllers/application_controller.rb | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/webservice/app/controllers/application_controller.rb b/webservice/app/controllers/application_controller.rb
index c924451..7532f38 100644
--- a/webservice/app/controllers/application_controller.rb
+++ b/webservice/app/controllers/application_controller.rb
@@ -10,14 +10,20 @@ class ApplicationController < ActionController::Base
render :text => "#{exception.message}\n Backtrace:\n #{exception.backtrace.join("\n")}", :status => 500
end
- rescue_from BackendException do |exception|
- render :xml => exception, :status => 503
- end
+ rescue_from BackendException, :with => :report_backend_exception
rescue_from InvalidParameters do |exception|
render :xml => exception, :status => 422 #422-resource invalid
end
+ rescue_from YaST::ConfigFile::NotFoundError do |exception|
+ #catch uncaught exception from reading yaml and report as
+ #Backend problem
+ logger.warn "Uncaught ConfigFile::NotFound exception. Reported as CorruptedFile"
+ report_backend_exception CorruptedFileException.new(exception.path)
+
+ end
+
include AuthenticatedSystem
@@ -33,4 +39,9 @@ class ApplicationController < ActionController::Base
# Uncomment this to filter the contents of submitted sensitive data parameters
# from your application log (in this case, all fields with names like "password").
filter_parameter_logging :password
+
+ private
+ def report_backend_exception(exception)
+ render :xml => exception, :status => 503
+ end
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org