Mailinglist Archive: yast-devel (246 mails)

< Previous Next >
[yast-devel] Re: [yast-commit] <rest-service> master : service.rb - catch exceptions
  • From: Klaus Kaempf <kkaempf@xxxxxxx>
  • Date: Mon, 24 Aug 2009 14:26:18 +0200
  • Message-id: <20090824122618.GA21498@xxxxxxxxxxxxx>
* Ladislav Slezak <lslezak@xxxxxxxxxx> [Aug 24. 2009 14:10]:
ref: refs/heads/master
commit 1a456b37d160ae603431cd56e1617330047e6a90
Author: Ladislav Slezak <lslezak@xxxxxxxxxx>
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@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages