add special clause for timeouts on post searches

This commit is contained in:
albert
2013-02-19 14:22:09 -05:00
parent 9d5cd91fa1
commit da35349955
2 changed files with 12 additions and 1 deletions

View File

@@ -10,6 +10,13 @@ class PostsController < ApplicationController
respond_with(@posts) do |format|
format.atom
end
rescue ::ActiveRecord::StatementInvalid => e
if e.to_s =~ /statement timeout/
@error_message = "The database timed out running your query. Try a simpler query that returns fewer results."
render :action => "error"
else
raise
end
end
def show

View File

@@ -1 +1,5 @@
<p>Error: <%= @exception.to_s %></p>
<% if @error_message %>
<p><%= @error_message %></p>
<% else %>
<p>Error: <%= @exception.to_s %></p>
<% end %>