mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Provide a better error if the parsed REXML document has no root [#3803 state:resolved]
This commit is contained in:
parent
41e7c68d87
commit
48c1d8c341
1 changed files with 7 additions and 1 deletions
|
@ -27,7 +27,13 @@ module ActiveSupport
|
|||
data.ungetc(char)
|
||||
silence_warnings { require 'rexml/document' } unless defined?(REXML::Document)
|
||||
doc = REXML::Document.new(data)
|
||||
merge_element!({}, doc.root)
|
||||
|
||||
if doc.root
|
||||
merge_element!({}, doc.root)
|
||||
else
|
||||
raise REXML::ParseException,
|
||||
"The document #{doc.to_s.inspect} does not have a valid root"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue