summaryrefslogtreecommitdiffstats
path: root/lib/redmine/configuration.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-07 18:54:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-07 18:54:41 +0000
commit24317f617e49fa6008e341449b3c9219166345a9 (patch)
tree8e864f8991e769b55a34fafb51eafdda64c5226c /lib/redmine/configuration.rb
parentfd32f7446da9ee7eef59182e230535d74efe5cc5 (diff)
downloadredmine-24317f617e49fa6008e341449b3c9219166345a9.tar.gz
redmine-24317f617e49fa6008e341449b3c9219166345a9.zip
Adds an explicit error message for invalid YAML configuration file (#9748).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8112 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/configuration.rb')
-rw-r--r--lib/redmine/configuration.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb
index 4257861c3..bd4696bd2 100644
--- a/lib/redmine/configuration.rb
+++ b/lib/redmine/configuration.rb
@@ -79,7 +79,13 @@ module Redmine
private
def load_from_yaml(filename, env)
- yaml = YAML::load_file(filename)
+ yaml = nil
+ begin
+ yaml = YAML::load_file(filename)
+ rescue ArgumentError
+ $stderr.puts "Your Redmine configuration file located at #{filename} is not a valid YAML file and could not be loaded."
+ exit 1
+ end
conf = {}
if yaml.is_a?(Hash)
if yaml['default']
@@ -89,7 +95,7 @@ module Redmine
conf.merge!(yaml[env])
end
else
- $stderr.puts "#{filename} is not a valid Redmine configuration file"
+ $stderr.puts "Your Redmine configuration file located at #{filename} is not a valid Redmine configuration file."
exit 1
end
conf