Permalink
Browse files

Merge pull request #8279 from gaurish/database_error

Improved Error handling when parsing database.yaml, Fixes #8143
  • Loading branch information...
2 parents 03ef833 + 61425f2 commit abb38feac84da59f6686d9abcce61d2a9a64efa9 @carlosantoniodasilva carlosantoniodasilva committed Nov 20, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 railties/lib/rails/application/configuration.rb
@@ -105,6 +105,10 @@ def threadsafe!
def database_configuration
require 'erb'
YAML.load ERB.new(IO.read(paths["config/database"].first)).result
+ rescue Psych::SyntaxError => e
+ raise "YAML syntax error occurred while parsing #{paths["config/database"].first}. " \
+ "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
+ "Error: #{e.message}"
end
def log_level

0 comments on commit abb38fe

Please sign in to comment.