Permalink
Browse files

Better Error handling when parsing database.yaml

Provides a better error message incase the database.yaml
has some errors.
  • Loading branch information...
1 parent 03ef833 commit 61425f2c6d14fe7151b09ffe5a5353924582e5b0 @gaurish gaurish 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 61425f2

Please sign in to comment.