Martin Kudlvasr write: > ref: refs/heads/master > commit 0e1503bd595f3058177385cb222914cfb6ac9466 > Author: Martin Kudlvasr <[email protected]> > Date: Tue Oct 20 16:10:11 2009 +0200 > > treat absence of eulas.yml as blank eulas list (==all eulas are > accepted) and corruption of eulas.yml as error > --- > plugins/eulas/app/models/license.rb | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/plugins/eulas/app/models/license.rb > b/plugins/eulas/app/models/license.rb index 319a533..b6c393b 100644 > --- a/plugins/eulas/app/models/license.rb > +++ b/plugins/eulas/app/models/license.rb > @@ -71,11 +71,13 @@ class License > end > > def self.license_names > + config = YaST::ConfigFile.new(:eulas) > begin > - config = YaST::ConfigFile.new(:eulas)
Yes, you can move it outside of begin as initialize doesn't throw exception. But how you know it? I think that it is not from documentation( http://w3.suse.de/~jreidinger/webservice/webservice/classes/YaST/ConfigFile.html ) so I suggest that you can improve it (document which method throw exceptions). > config["licenses"] || [] > - rescue Exception => e > + rescue YaST::ConfigFile::NotFoundError > [] # treat absense or corruption of eulas.yml as "no eulas" > + rescue Exception > + raise CorruptedFileException.new config.path > end > end > -- Josef Reidinger YaST team maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and time -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
