Skip to content

Commit abb38fe

Browse files
Merge pull request rails#8279 from gaurish/database_error
Improved Error handling when parsing database.yaml, Fixes rails#8143
2 parents 03ef833 + 61425f2 commit abb38fe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

railties/lib/rails/application/configuration.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ def threadsafe!
105105
def database_configuration
106106
require 'erb'
107107
YAML.load ERB.new(IO.read(paths["config/database"].first)).result
108+
rescue Psych::SyntaxError => e
109+
raise "YAML syntax error occurred while parsing #{paths["config/database"].first}. " \
110+
"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
111+
"Error: #{e.message}"
108112
end
109113

110114
def log_level

0 commit comments

Comments
 (0)