Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoload SyntaxErrorInTemplate #36521

Merged
merged 1 commit into from
Jun 19, 2019

Conversation

itsWill
Copy link
Contributor

@itsWill itsWill commented Jun 19, 2019

Summary

Came out of looking into this: #36341

When a SyntaxError is detected in a template we raise this exception: SyntaxErrorInTemplate. 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.

Before the patch the first request looks like:

Screen Shot 2019-06-19 at 1 53 12 PM

And the log information is silenced by the DebugExceptions middleware.

After the patch this looks like:

Screen Shot 2019-06-19 at 1 52 51 PM

cc: @gmcgibbon

Copy link
Member

@gmcgibbon gmcgibbon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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>
@gmcgibbon gmcgibbon merged commit 75eb949 into rails:master Jun 19, 2019
eugeneius pushed a commit to eugeneius/rails that referenced this pull request Dec 21, 2019
kaspth added a commit that referenced this pull request Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants