aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-03-17 10:49:07 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-03-17 10:49:07 -0700
commitba3ad256c6d33aa7789319666d4cef4e7210758c (patch)
tree20143d600e6ce9c6967189229fbe62996b163ce3 /actionpack/lib
parent8ba60912ca42a66cb59a31346623a6f9d2439192 (diff)
parent933e9b4fe2710f8a5bfe0b00c09361e1aea12a9d (diff)
downloadrails-ba3ad256c6d33aa7789319666d4cef4e7210758c.tar.gz
rails-ba3ad256c6d33aa7789319666d4cef4e7210758c.tar.bz2
rails-ba3ad256c6d33aa7789319666d4cef4e7210758c.zip
Merge pull request #14090 from Fortisque/kevin/stream_error_in_main_thread_if_not_committed
re-raise error if error occurs before committing in streaming
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/metal/live.rb21
1 files changed, 11 insertions, 10 deletions
diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb
index 41b997a755..acf40b2e16 100644
--- a/actionpack/lib/action_controller/metal/live.rb
+++ b/actionpack/lib/action_controller/metal/live.rb
@@ -228,18 +228,19 @@ module ActionController
begin
super(name)
rescue => e
- unless @_response.committed?
+ if @_response.committed?
+ begin
+ @_response.stream.write(ActionView::Base.streaming_completion_on_exception) if request.format == :html
+ @_response.stream.call_on_error
+ rescue => exception
+ log_error(exception)
+ ensure
+ log_error(e)
+ @_response.stream.close
+ end
+ else
error = e
end
- begin
- @_response.stream.write(ActionView::Base.streaming_completion_on_exception) if request.format == :html
- @_response.stream.call_on_error
- rescue => exception
- log_error(exception)
- ensure
- log_error(e)
- @_response.stream.close
- end
ensure
@_response.commit!
end