lib/lite_config.rb in lite_config-0.0.2 vs lib/lite_config.rb in lite_config-0.0.3

- old
+ new

@@ -5,10 +5,11 @@ require 'yaml' module LiteConfig class ImmutableError < StandardError; end + class NotFoundError < StandardError; end extend self def fetch(name) name = name.to_sym @@ -33,18 +34,20 @@ end private def load(name) - config = load_single(config_filename(name)) + if File.exist?(config_filename(name)) + config = load_single(config_filename(name)) + else + raise NotFoundError, "No config found for #{name}" + end if File.exist?(local_config_filename(name)) local_config = load_single(local_config_filename(name)) config.deep_merge!(local_config) if local_config end - - raise "Oops, no #{app_env} config found for #{name} in #{filename}" unless config config end def load_single(filename)