Autoload SyntaxErrorInTemplate

When a SyntaxError is detected in a template we raise this exception. On
a first request to the server the exception we get a NameError since the
exception is not required from `active_view/template/error.rb` yet.
However later on it gets required and a second request will succeed.
On the first request we see the rails "Something Wen Wrong" page and not
the expected syntax error in template error page with the webconsole and
stacktrace. By autoloading the constant we fix this issue.

Co-authored-by: Gannon McGibbon <gannon.mcgibbon@gmail.com>
This commit is contained in:
Guilherme Mansur 2019-06-19 13:42:52 -04:00
parent aae270de9e
commit 99e52ae7b1
2 changed files with 5 additions and 0 deletions

View File

@ -1,3 +1,7 @@
* Add autoload for SyntaxErrorInTemplate so syntax errors are correctly raised by DebugExceptions.
*Guilherme Mansur*, *Gannon McGibbon*
* `RenderingHelper` supports rendering objects that `respond_to?` `:render_in`
*Joel Hawksley*, *Natasha Umer*, *Aaron Patterson*, *Shawn Allen*, *Emily Plummer*, *Diana Mounter*, *John Hawthorn*, *Nathan Herald*, *Zaid Zawaideh*, *Zach Ahn*

View File

@ -77,6 +77,7 @@ module ActionView
autoload :ActionViewError
autoload :EncodingError
autoload :TemplateError
autoload :SyntaxErrorInTemplate
autoload :WrongEncodingError
end
end