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 ff3f67efd975d46d76312a35f97fcf44c7899df9..acc478c152c4b68aa04bab1d8d84862b22183d45 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