Skip to content

Commit 2eb6dd5

Browse files
convert streaming errors to ReactOnRails::PrerenderError
1 parent 2bf472d commit 2eb6dd5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/react_on_rails/helper.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,15 @@ def server_rendered_react_component(render_options)
587587
# It doesn't make any transformation, it listens and raises error if a chunk has errors
588588
chunk_json_result
589589
end
590+
591+
result.rescue do |err|
592+
# This error came from the renderer
593+
raise ReactOnRails::PrerenderError.new(component_name: react_component_name,
594+
# Sanitize as this might be browser logged
595+
props: sanitized_props_string(props),
596+
err: err,
597+
js_code: js_code)
598+
end
590599
elsif result["hasErrors"] && render_options.raise_on_prerender_error
591600
raise_prerender_error(result, react_component_name, props, js_code)
592601
end

0 commit comments

Comments
 (0)