Mailinglist Archive: yast-commit (1771 mails)

< Previous Next >
[yast-commit] <rest-service> master : catch exceptions, return an error message
  • From: Ladislav Slezak <lslezak@xxxxxxxxxx>
  • Date: Tue, 1 Sep 2009 16:00:03 +0200
  • Message-id: <E1MiTu2-0006vV-UK@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit e3f4f4eb81c5ffdc3c658f7838b0c91c53fed098
Author: Ladislav Slezak <lslezak@xxxxxxxxxx>
Date: Tue Sep 1 15:59:33 2009 +0200

catch exceptions, return an error message
---
.../app/controllers/services_controller.rb | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/plugins/services/app/controllers/services_controller.rb
b/plugins/services/app/controllers/services_controller.rb
index 246e822..fd3a471 100644
--- a/plugins/services/app/controllers/services_controller.rb
+++ b/plugins/services/app/controllers/services_controller.rb
@@ -8,7 +8,11 @@ class ServicesController < ApplicationController
render ErrorResult.error(403, 1, "no permission") and return
end

- @services = Service.find_all params
+ begin
+ @services = Service.find_all params
+ rescue Exception => e
+ render ErrorResult.error(404, 107, e.to_s) and return
+ end
end

# GET /services/service_name
@@ -20,7 +24,12 @@ class ServicesController < ApplicationController
end

@service = Service.new(params[:id])
- @service.read_status
+
+ begin
+ @service.read_status
+ rescue Exception => e
+ render ErrorResult.error(404, 108, e.to_s) and return
+ end

respond_to do |format|
format.html { render :xml => @service.to_xml(:root => 'service',
:dasherize => false), :location => "none" } #return xml only
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages