1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix instrumenting internal server errors

In case of an exception we never reach setting the status in the
payload so it is unset afterward.

Let's catch the exception and set status based on the exception class name.
Then re-raise it.

This is basically the equivalent of what happens in

ActionController::LogSubscriber.process_action
This commit is contained in:
Henne Vogelsang 2020-07-19 14:43:53 +02:00
parent 738ca3595f
commit 1966806cd0
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6

View file

@ -35,6 +35,9 @@ module ActionController
payload[:response] = response
payload[:status] = response.status
result
rescue => error
payload[:status] = ActionDispatch::ExceptionWrapper.status_code_for_exception(error.class.name)
raise
ensure
append_info_to_payload(payload)
end