lib/splash/backends.rb in prometheus-splash-0.1.1 vs lib/splash/backends.rb in prometheus-splash-0.2.0
- old
+ new
@@ -2,12 +2,19 @@
Dir[File.dirname(__FILE__) + '/backends/*.rb'].each {|file| require file }
module Splash
module Backends
include Splash::Config
+ include Splash::Constants
+
def get_backend(store)
- aclass = "Splash::Backends::#{get_config[:backends][:stores][store][:type].to_s.capitalize}"
- return Kernel.const_get(aclass)::new(store)
+ backend = get_config[:backends][:stores][store][:type].to_s
+ aclass = "Splash::Backends::#{backend.capitalize}"
+ begin
+ return Kernel.const_get(aclass)::new(store)
+ rescue
+ splash_exit case: :configuration_error, more: "Backend specified for store #{store} inexistant : #{backend}"
+ end
end
end
end