[yast-devel] Re: [yast-commit] <rest-service> master : service.rb - catch exceptions
* Ladislav Slezak <lslezak@novell.com> [Aug 24. 2009 14:10]:
ref: refs/heads/master commit 1a456b37d160ae603431cd56e1617330047e6a90 Author: Ladislav Slezak <lslezak@novell.com> Date: Mon Aug 24 10:20:10 2009 +0200
service.rb - catch exceptions --- plugins/services/app/models/service.rb | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/plugins/services/app/models/service.rb b/plugins/services/app/models/service.rb index 2904bc0..1632c6a 100644 --- a/plugins/services/app/models/service.rb +++ b/plugins/services/app/models/service.rb @@ -38,7 +38,8 @@ class Service "runlevel" => [ "i", rl == "S" ? -1 : rl.to_i ], "read_status" => [ "b", read_status] } - yapi_ret = YastService.Call("YaPI::SERVICES::Read", params) + + yapi_ret = YastService.Call("YaPI::SERVICES::Read", params) rescue nil
if yapi_ret.nil? raise "Can't get services list"
This effectively throws away all information which came from the original exception. Don't do that. YastService.Call should never return nil but just raise an exeception (with information about the cause of the failure). You can then either catch it in your controller or let it 'bubble' up to the generic error display. Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (1)
-
Klaus Kaempf