mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Better Error handling when parsing database.yaml
Provides a better error message incase the database.yaml has some errors.
This commit is contained in:
parent
03ef833b80
commit
61425f2c6d
1 changed files with 4 additions and 0 deletions
|
@ -105,6 +105,10 @@ module Rails
|
||||||
def database_configuration
|
def database_configuration
|
||||||
require 'erb'
|
require 'erb'
|
||||||
YAML.load ERB.new(IO.read(paths["config/database"].first)).result
|
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
|
end
|
||||||
|
|
||||||
def log_level
|
def log_level
|
||||||
|
|
Loading…
Reference in a new issue