Skip to content

Commit e91271a

Browse files
committed
Fix ActionDispatch::Executor to unwrap exceptions like other middlewares
Fix: rails#53938 `ShowExceptions` and `DebugExceptions` know about some specific error classes that aren't meant to be displayed but simply wrap the real underlying error. `ActionDispatch::Executor` should use the same logic.
1 parent a725732 commit e91271a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

actionpack/lib/action_dispatch/middleware/executor.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ def call(env)
2222

2323
returned = response << ::Rack::BodyProxy.new(response.pop) { state.complete! }
2424
rescue => error
25-
@executor.error_reporter.report(error, handled: false, source: "application.action_dispatch")
25+
request = ActionDispatch::Request.new env
26+
backtrace_cleaner = request.get_header("action_dispatch.backtrace_cleaner")
27+
wrapper = ExceptionWrapper.new(backtrace_cleaner, error)
28+
@executor.error_reporter.report(wrapper.unwrapped_exception, handled: false, source: "application.action_dispatch")
2629
raise
2730
ensure
2831
state.complete! unless returned

0 commit comments

Comments
 (0)