aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/renderer/streaming_template_renderer.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-04-19 12:25:01 +0200
committerJosé Valim <jose.valim@gmail.com>2011-04-19 12:26:11 +0200
commitb398520c1406824efd12df6bb57996aa9781f876 (patch)
treecad818bf1981a31eb10f257692167f10575aafb0 /actionpack/lib/action_view/renderer/streaming_template_renderer.rb
parenta66c91723565d37969de4cb46baa50fb8865b02a (diff)
downloadrails-b398520c1406824efd12df6bb57996aa9781f876.tar.gz
rails-b398520c1406824efd12df6bb57996aa9781f876.tar.bz2
rails-b398520c1406824efd12df6bb57996aa9781f876.zip
Output a redirect to the 500 page if something happens when streaming.
Currently, we output: "><script type="text/javascript">window.location = "/500.html"</script></html>
Diffstat (limited to 'actionpack/lib/action_view/renderer/streaming_template_renderer.rb')
-rw-r--r--actionpack/lib/action_view/renderer/streaming_template_renderer.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/renderer/streaming_template_renderer.rb b/actionpack/lib/action_view/renderer/streaming_template_renderer.rb
index 52f0e9f5bd..03aab444f8 100644
--- a/actionpack/lib/action_view/renderer/streaming_template_renderer.rb
+++ b/actionpack/lib/action_view/renderer/streaming_template_renderer.rb
@@ -46,11 +46,8 @@ module ActionView
#
# == TODO
#
- # * Add streaming support in the controllers with no-cache settings
- # * What should happen when an error happens?
# * Support streaming from child templates, partials and so on.
- # * Support on sprockets async JS load?
- #
+ # * Integrate exceptions with exceptron
class StreamingTemplateRenderer < TemplateRenderer #:nodoc:
# A valid Rack::Body (i.e. it responds to each).
# It is initialized with a block that, when called, starts
@@ -61,7 +58,11 @@ module ActionView
end
def each(&block)
- @start.call(block)
+ begin
+ @start.call(block)
+ rescue
+ block.call ActionView::Base.streaming_completion_on_exception
+ end
self
end
end