admin管理员组文章数量:1356071
From my understanding
config/environments/development.rb
# Show full error reports.
config.consider_all_requests_local = true
should show the full trace stack when an error occurs in development.
However, when I start the server in development
web | => Booting Puma
web | => Rails 7.1.5.1 application starting in development
web | => Run `bin/rails server --help` for more startup options
web | Puma starting in single mode...
web | * Puma version: 6.6.0 ("Return to Forever")
web | * Ruby version: ruby 3.3.7 (2025-01-15 revision be31f993d7) [x86_64-darwin22]
web | * Min threads: 5
web | * Max threads: 5
web | * Environment: development
web | * PID: 7727
web | * Listening on :3000
web | Use Ctrl-C to stop
and an error occurs, I get
with no trace neither in the console
web | Session Load (1.3ms) SELECT "sessions".* FROM "sessions" WHERE "sessions"."id" = $1 ORDER BY created_at DESC LIMIT $2 [["id", 101444], ["LIMIT", 1]]
web | ↳ app/controllers/application_controller.rb:64:in `set_session'
web | Completed 500 Internal Server Error in 216ms (ActiveRecord: 52.6ms | Allocations: 54411)
Am I missing something here?
UPDATE 1
def set_session
Current.session = Session.find_by(id: session[:id])
end
UPDATE 2
sig@mbp myapp % bin/rails c
Loading development environment (Rails 7.1.5.1)
irb(main):001> Rails.application.config.consider_all_requests_local
=> true
UPDATE 3
↳ app/controllers/application_controller.rb:64:in `set_session'
show_detailed_exceptions: true"
[4, 13] in ~/Code/myapp/app/controllers/sessions_controller.rb
4|
5| layout 'login'
6|
7| def new
8| p show_detailed_exceptions: #{request.get_header("action_dispatch.show_detailed_exceptions")}"
=> 9| debugger do: "break ActionDispatch::DebugExceptions#render_exception"
10| here_the_error
11| end
12|
13| def create
=>#0 SessionsController#new at ~/Code/myapp/app/controllers/sessions_controller.rb:9
#1 ActionController::BasicImplicitRender#send_action(method="new", args=[]) at ~/.rbenv/versions/3.3.7/lib/ruby/gems/3.3.0/gems/actionpack-7.1.5.1/lib/action_controller/metal/basic_implicit_render.rb:6
# and 82 frames (use `bt' command for all frames)
(rdbg:#debugger) break ActionDispatch::DebugExceptions#render_exception
duplicated breakpoint: BP - Method ActionDispatch::DebugExceptions#render_exception at /Users/sig/.rbenv/versions/3.3.7/lib/ruby/gems/3.3.0/gems/web-console-3.7.0/lib/web_console/extensions.rb:27
UPDATE 4
I added a print to the following files
# lib/action_dispatch/middleware/show_exceptions.rb
def render_exception(request, wrapper)
p "I RENDER EXCEPTION IN SHOW"
[ORIGINAL CODE]
end
# lib/action_dispatch/middleware/debug_exceptions.rb
def render_exception(request, exception, wrapper)
p "I RENDER EXCEPTION IN DEBUG"
[ORIGINAL CODE]
end
Then, when I hit the error, I get the following:
Processing by SessionsController#new as HTML
Session Load (2.0ms) SELECT "sessions".* FROM "sessions" WHERE "sessions"."id" = $1 ORDER BY created_at DESC LIMIT $2 [["id", 101452], ["LIMIT", 1]]
↳ app/controllers/application_controller.rb:64:in `set_session'
"======> true"
User Load (3.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY name LIMIT $2 [["id", 2], ["LIMIT", 1]]
↳ app/controllers/application_controller.rb:29:in `current_user'
Completed 500 Internal Server Error in 267ms (ActiveRecord: 23.4ms | Allocations: 34184)
"I RENDER EXCEPTION IN SHOW"
I reached the "wrong" render_exception
本文标签: Rails development not showing error traceStack Overflow
版权声明:本文标题:Rails development not showing error trace - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744049454a2582152.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论