diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 9d6e45271..7948dbcca 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -14,12 +14,12 @@ class ApplicationController < ActionController::Base
protected
def rescue_exception(exception)
@exception = exception
- render :action => "static/error", :status => 500
+ render :template => "static/error", :status => 500
end
def render_pagination_limit
- @error_message = "You can view up to 1,000 pages. Please narrow your search terms."
- render :action => "static/error", :status => 410
+ @error_message = "You can only view up to #{Danbooru.config.max_numbered_pages} pages. Please narrow your search terms."
+ render :template => "static/error", :status => 410
end
def access_denied
diff --git a/app/controllers/legacy_controller.rb b/app/controllers/legacy_controller.rb
index 65f13d2ca..dc0db8ccf 100644
--- a/app/controllers/legacy_controller.rb
+++ b/app/controllers/legacy_controller.rb
@@ -1,6 +1,6 @@
class LegacyController < ApplicationController
before_filter :member_only, :only => [:create_post]
- rescue_from PostSets::SearchError, :with => :error
+ rescue_from PostSets::SearchError, :with => :rescue_exception
def posts
@post_set = PostSets::Post.new(tag_query, params[:page], params[:limit])
@@ -31,9 +31,6 @@ class LegacyController < ApplicationController
def unavailable
render :text => "this resource is no longer available", :status => 410
end
-
- def error
- end
private
def tag_query
diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb
index 3379f06b0..ce98dc6cc 100644
--- a/app/controllers/static_controller.rb
+++ b/app/controllers/static_controller.rb
@@ -2,4 +2,7 @@ class StaticController < ApplicationController
def terms_of_service
render :layout => "blank"
end
+
+ def error
+ end
end
diff --git a/app/views/legacy/tags.json.erb b/app/views/legacy/tags.json.erb
new file mode 100644
index 000000000..db7cba122
--- /dev/null
+++ b/app/views/legacy/tags.json.erb
@@ -0,0 +1 @@
+[<%= @tags.map {|x| x.to_legacy_json}.join(", ").html_safe %>]
diff --git a/app/views/posts/error.json.erb b/app/views/posts/error.json.erb
deleted file mode 100644
index b913112fc..000000000
--- a/app/views/posts/error.json.erb
+++ /dev/null
@@ -1 +0,0 @@
-{success: false, message: "<%= @exception.to_s %>"}
\ No newline at end of file
diff --git a/app/views/posts/error.xml.erb b/app/views/posts/error.xml.erb
deleted file mode 100644
index 9808698dd..000000000
--- a/app/views/posts/error.xml.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-
-<%= @exception.to_s %>
diff --git a/app/views/static/error.atom.erb b/app/views/static/error.atom.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/posts/error.html.erb b/app/views/static/error.html.erb
similarity index 100%
rename from app/views/posts/error.html.erb
rename to app/views/static/error.html.erb
diff --git a/app/views/static/error.json.erb b/app/views/static/error.json.erb
new file mode 100644
index 000000000..133ffdc03
--- /dev/null
+++ b/app/views/static/error.json.erb
@@ -0,0 +1,5 @@
+<% if @error_message %>
+{success: false, message: <%= raw @error_message.to_json %>}
+<% else %>
+{success: false, message: <%= raw @exception.to_s.to_json %>}
+<% end %>
diff --git a/app/views/static/error.xml.erb b/app/views/static/error.xml.erb
new file mode 100644
index 000000000..1a87fac85
--- /dev/null
+++ b/app/views/static/error.xml.erb
@@ -0,0 +1,6 @@
+
+<% if @error_message %>
+<%= @error_message %>
+<% else %>
+<%= @exception.to_s %>
+<% end %>
\ No newline at end of file