Skip calling concat() when exception.annotated_source_code returns ni… #38820
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This fix is to address an identical problem described in #36719.
I can confirm the more general issue of some exceptions not being logged in the console on development still exists. I've had a couple of issues crop up in the past weeks around
sassc
compilation errors and today with anActionView::Template::Error (Multiple files with the same output path cannot be linked)
error, with the exceptions never being displayed in the console, leaving me completely stumped as to why my Rails app was returning HTTP 500 / error pages.In my situation, I was able to step down to https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L146 and determine that
concat()
is throwing a new exception, causing the logging to be completely silenced whenexception.annotated_source_code
returnsnil
.I've self-tested this fix and it now logs the exceptions as one would expect. Hopefully this saves people a lot of time that I've spent tracking down silent errors.
Other Information
I was able to trigger this silent exception issue when a
ActionView::Template::Error (Multiple files with the same output path cannot be linked...)
exception was thrown. The easiest way I know to do this is make a copy of an existing coffeescript file with another preprocessor extension such as having both files exist:/app/assets/javascripts/file.coffee
and/app/assets/javascripts/file.coffee.erb
then try loading a page in your browser.