Reworking errors with configuration file.
This commit is contained in:
parent
90fa3f2921
commit
f6d38def5a
|
@ -131,16 +131,17 @@ module Jekyll
|
||||||
config_file = File.join(source, '_config.yml')
|
config_file = File.join(source, '_config.yml')
|
||||||
begin
|
begin
|
||||||
config = YAML.load_file(config_file)
|
config = YAML.load_file(config_file)
|
||||||
raise "Invalid configuration file: #{config_file}" if !config.is_a?(Hash)
|
raise "Configuration file: (INVALID) #{config_file}" if !config.is_a?(Hash)
|
||||||
$stdout.puts "Configuration file: #{config_file}"
|
$stdout.puts "Configuration file: #{config_file}"
|
||||||
|
rescue SystemCallError
|
||||||
|
# Errno:ENOENT = file not found
|
||||||
|
$stderr.puts "Configuration file: none"
|
||||||
|
config = {}
|
||||||
rescue => err
|
rescue => err
|
||||||
unless File.exists?(config_file)
|
$stderr.puts " " +
|
||||||
$stdout.puts "Configuration file: none"
|
"WARNING: Error reading configuration. " +
|
||||||
else
|
"Using defaults (and options)."
|
||||||
$stderr.puts "WARNING: Could not read configuration. " +
|
$stderr.puts "#{err}"
|
||||||
"Using defaults (and options)."
|
|
||||||
$stderr.puts "\t" + err.to_s
|
|
||||||
end
|
|
||||||
config = {}
|
config = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue