Detect a timeout encapsulated in ActionView::Template::Error
authorTom Hughes <tom@compton.nu>
Mon, 6 Mar 2017 17:50:09 +0000 (17:50 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 6 Mar 2017 17:50:09 +0000 (17:50 +0000)
Fixes #1476

app/controllers/application_controller.rb

index ff3f67e..acc478c 100644 (file)
@@ -365,7 +365,8 @@ class ApplicationController < ActionController::Base
   rescue ActionView::Template::Error => ex
     ex = ex.original_exception
 
-    if ex.is_a?(ActiveRecord::StatementInvalid) && ex.message =~ /execution expired/
+    if ex.is_a?(Timeout::Error) ||
+       (ex.is_a?(ActiveRecord::StatementInvalid) && ex.message =~ /execution expired/)
       render :action => "timeout"
     else
       raise