List Info

Thread: Question about error handling in *Store




Question about error handling in *Store
user name
2006-04-26 19:49:19
Hi people,

I notice that all the Og::Store subclasses are defined in
files with an 
header similar to

begin
   require 'sqlite'
rescue Object => ex
   Logger.error 'Ruby-Sqlite bindings are not installed!'
   Logger.error ex
end


There are two things I found strange in this, first, it
seems excessive 
to hide all possible exceptions by rescueing Object, I think
that 
LoadError would be a better fit; second, I 'm not sure I
undesrtand why 
the problem is just logged instead of letting the
application crash, 
because in most cases there will be a crash whenever
something is done 
that is store related,  by referencing a a nil object.

It seem to me that this is a bad thing and that a
crash-early approach 
would be better and allow faster diagnostics, but maybe
there is 
something I have overlooked.
Someone who would like to still use the application withouth
having a 
real reference to a Store could just create an empty foo.rb
in src/ and 
go on anyway.

_______________________________________________
Nitro-general mailing list
Nitro-generalrubyforge.org
h
ttp://rubyforge.org/mailman/listinfo/nitro-general
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )