[Nitro] Question about error handling in *Store
gabriele renzi
surrender_it at yahoo.it
Wed Apr 26 15:49:19 EDT 2006
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.
More information about the Nitro-general
mailing list