提交 307b6b5e 编写于 作者: R Rafael França

Merge pull request #22856 from rthbound/adds-exception-object-to-instrumenter-payload

Adds exception object to instrumenter's payload
......@@ -515,4 +515,10 @@
*Logan Leger*
* Adds `:exception_object` key to ActiveSupport::Notifications::Instrumenter payload when an exception is raised
Adds new key/value pair to payload when an exception is raised: e.g. `:exception_object => #<RuntimeError: FAIL>`
*Ryan T. Hosford*
Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activesupport/CHANGELOG.md) for previous changes.
......@@ -21,6 +21,7 @@ def instrument(name, payload={})
yield payload
rescue Exception => e
payload[:exception] = [e.class.name, e.message]
payload[:exception_object] = e
raise e
ensure
finish_with_state listeners_state, name, payload
......
......@@ -232,7 +232,7 @@ def test_instrument_publishes_when_exception_is_raised
assert_equal 1, @events.size
assert_equal Hash[:payload => "notifications",
:exception => ["RuntimeError", "FAIL"]], @events.last.payload
:exception => ["RuntimeError", "FAIL"], :exception_object => e], @events.last.payload
end
def test_event_is_pushed_even_without_block
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册