aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal
diff options
context:
space:
mode:
authorKevin Casey <kacasey@berkeley.edu>2014-02-17 18:41:21 -0800
committerKevin Casey <kacasey@berkeley.edu>2014-03-14 23:54:43 -0700
commit933e9b4fe2710f8a5bfe0b00c09361e1aea12a9d (patch)
tree0145e0a1d5e603642cd3b1b2861d771afd342243 /actionpack/lib/action_controller/metal
parentb4c96490eeb1fbb944e116c7703dd528b37fc08a (diff)
downloadrails-933e9b4fe2710f8a5bfe0b00c09361e1aea12a9d.tar.gz
rails-933e9b4fe2710f8a5bfe0b00c09361e1aea12a9d.tar.bz2
rails-933e9b4fe2710f8a5bfe0b00c09361e1aea12a9d.zip
re-raise error if error occurs before committing in streaming
update the tests, using an if-else
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-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