diff --git a/app/controllers/post_votes_controller.rb b/app/controllers/post_votes_controller.rb
index b90577460..0331c60ee 100644
--- a/app/controllers/post_votes_controller.rb
+++ b/app/controllers/post_votes_controller.rb
@@ -1,20 +1,20 @@
class PostVotesController < ApplicationController
before_action :voter_only
skip_before_action :api_check
+ respond_to :js, :json, :xml
+ rescue_with PostVote::Error, status: 422
def create
@post = Post.find(params[:post_id])
@post.vote!(params[:score])
- rescue PostVote::Error, ActiveRecord::RecordInvalid => x
- @error = x
- render status: 500
+
+ respond_with(@post)
end
def destroy
@post = Post.find(params[:post_id])
@post.unvote!
- rescue PostVote::Error => x
- @error = x
- render status: 500
+
+ respond_with(@post)
end
end
diff --git a/app/views/post_votes/create.js.erb b/app/views/post_votes/create.js.erb
index 3deae6cd3..92bdeec28 100644
--- a/app/views/post_votes/create.js.erb
+++ b/app/views/post_votes/create.js.erb
@@ -1,9 +1,5 @@
-<% if @error %>
- $(window).trigger("danbooru:notice", "<%= j @error.to_s %>");
-<% else %>
- $(window).trigger("danbooru:notice", "Vote saved");
- $("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
-<% end %>
+Danbooru.Utility.notice("Vote saved");
+$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
$("#vote-links-for-post-<%= @post.id %>").hide();
$("#unvote-link-for-post-<%= @post.id %>").show();
diff --git a/app/views/post_votes/create.json.erb b/app/views/post_votes/create.json.erb
deleted file mode 100644
index 052990686..000000000
--- a/app/views/post_votes/create.json.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<% if @error %>
- {"success": false, "reason": <%= @error.to_s.to_json.html_safe %>}
-<% else %>
- {"success": true}
-<% end %>
diff --git a/app/views/post_votes/create.xml.erb b/app/views/post_votes/create.xml.erb
deleted file mode 100644
index 46666469e..000000000
--- a/app/views/post_votes/create.xml.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-
-<% if @error %>
- <%= @error.to_s %>
-<% else %>
-
-<% end %>
diff --git a/app/views/post_votes/destroy.js.erb b/app/views/post_votes/destroy.js.erb
index 0e5d07fa9..5466b6cfa 100644
--- a/app/views/post_votes/destroy.js.erb
+++ b/app/views/post_votes/destroy.js.erb
@@ -1,8 +1,5 @@
-<% if @error %>
- $(window).trigger("danbooru:notice", "<%= j @error.to_s %>");
-<% else %>
- $(window).trigger("danbooru:notice", "Unvoted successfully");
- $("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
-<% end %>
+Danbooru.Utility.notice("Unvoted successfully");
+$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
+
$("#vote-links-for-post-<%= @post.id %>").show();
$("#unvote-link-for-post-<%= @post.id %>").hide();
diff --git a/app/views/post_votes/destroy.json.erb b/app/views/post_votes/destroy.json.erb
deleted file mode 100644
index 052990686..000000000
--- a/app/views/post_votes/destroy.json.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<% if @error %>
- {"success": false, "reason": <%= @error.to_s.to_json.html_safe %>}
-<% else %>
- {"success": true}
-<% end %>
diff --git a/app/views/post_votes/destroy.xml.erb b/app/views/post_votes/destroy.xml.erb
deleted file mode 100644
index 46666469e..000000000
--- a/app/views/post_votes/destroy.xml.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-
-<% if @error %>
- <%= @error.to_s %>
-<% else %>
-
-<% end %>