-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
SyntaxError in an autoloading class referenced from a view causes "TypeError: Thread::Backtrace::Location object expected" #48326
Comments
cc: @tenderlove I tried to have a go at this issue and I have a proposed fix here: #48957 The error is raised inside MRI because the object we are passing to Once the issue was fixed though, something interesting appeared - we were displaying the error page, but without any extracted source. I traced this back to the way syntax errors raised inside an It would be great to have any suggestions on how to approach it better! |
I am experiencing an issue similar to this one, but I think the conditions to reproduce it are a little bit different. Steps to reproduce:
On Rails 7.1.1 and Ruby 3.2.2 It seems to me like as long as the syntax error is inside a partial used in a view, that is enough to get the same error from the modified ActionDispatch::ShowExceptions as was posted in the first post in this thread. I am hesitant to post a new issue even though the steps to produce seem different to me. Is this the same issue? Can anyone else verify that they are able to reproduce this by having a syntax error inside a partial rendered by a view? |
@ILiuz Yes, I can confirm that a ruby syntax error in a partial causes the same error and backtrace on 7.1.1 here as well. Since the backtrace is the same, I think it's another way of reproducing the same error and is seemingly the same issue. Backtrace with line numbers from 7.1.1 (but otherwise the same)
|
If a view renders code that autoloads a class that has a syntax error,
DebugExceptions
fails with aTypeError: Thread::Backtrace::Location object expected
.Backtrace
Steps to reproduce
test.rb
:view_test_1.html.erb
(placed in same base dir as test.rb):Expected behavior
A standard DebugExceptions response should display the initial
SyntaxError
exception.Actual behavior
DebugExceptions itself raises a
TypeError
with messageThread::Backtrace::Location object expected
, in turn causing a generic 500 error to be returned.System configuration
Rails version: main
Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered: