Module: TemplateStreaming::ErrorRecovery::View
- Defined in:
- lib/template_streaming/error_recovery.rb
Class Method Summary collapse
Instance Method Summary collapse
- #render_default_streaming_exceptions(exceptions) ⇒ Object
- #render_streaming_exceptions(exceptions) ⇒ Object
- #render_with_template_streaming_error_recovery(*args, &block) ⇒ Object
Class Method Details
.included(base) ⇒ Object
176 177 178 179 180 |
# File 'lib/template_streaming/error_recovery.rb', line 176 def self.included(base) base.class_eval do alias_method_chain :render, :template_streaming_error_recovery end end |
Instance Method Details
#render_default_streaming_exceptions(exceptions) ⇒ Object
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/template_streaming/error_recovery.rb', line 206 def render_default_streaming_exceptions(exceptions) # Ensure errors in the error rendering don't recurse. @rendering_default_streaming_exceptions = true begin @content = exceptions.map do |exception| template_path = ActionController::Rescue::RESCUES_TEMPLATE_PATH @exception = exception @rescues_path = template_path render :file => "#{template_path}/rescues/template_error.erb" end.join render :file => "#{File.dirname(__FILE__)}/templates/errors.erb" ensure @rendering_default_streaming_exceptions = false end end |
#render_streaming_exceptions(exceptions) ⇒ Object
202 203 204 |
# File 'lib/template_streaming/error_recovery.rb', line 202 def render_streaming_exceptions(exceptions) controller.streaming_error_renderer.call(self, exceptions) end |
#render_with_template_streaming_error_recovery(*args, &block) ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/template_streaming/error_recovery.rb', line 182 def render_with_template_streaming_error_recovery(*args, &block) if streaming_template? begin render_without_template_streaming_error_recovery(*args, &block) rescue ActionView::MissingTemplate => e # ActionView uses this as a signal to try another template format. raise e rescue Exception => e logger.error "#{e.class}: #{e.}" logger.error e.backtrace.join("\n").gsub(/^/, ' ') controller.streaming_error_callbacks.each{|c| c.call(e)} exceptions = controller.request.env[EXCEPTIONS_KEY] and exceptions << e '' end else render_without_template_streaming_error_recovery(*args, &block) end end |