Method: Cuca::Controller#handle_exception
- Defined in:
- lib/cuca/controller.rb
#handle_exception(e) ⇒ Object
this piece of code will handle a thrown exception BreakControllerException
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/cuca/controller.rb', line 264 def handle_exception(e) if e.flags.has_key?(:layout) then @_layout = e.flags[:layout] end if e.flags.has_key?(:no_after_filters) then @_stop_no_after_filters = true end if e.flags.has_key?(:redirect) then @_layout = false to = e.flags[:redirect] clear @_content = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\" content=\"0;url=#{to}\"></HEAD></HTML>" @cancel_execution = true end if e.flags.has_key?(:error) then @_layout = false http_status "SERVER_ERROR" clear = e.flags[:error] @cancel_execution = true trace = '' if Cuca::App.config['display_errors'] then e.backtrace.each do |b| trace<< "<br/>#{b}" end end mab { html { body { h2 "Error"; text ; br; text trace }}} end if e.flags.has_key?(:cancel_execution) then @cancel_execution = true end end |