favorites: fix error handling.
* Return HTTP 422 instead of HTTP 500 on "You have already favorited this post" errors. * Log unexpected errors in Ajax requests to the console.
This commit is contained in:
@@ -2,6 +2,7 @@ class FavoritesController < ApplicationController
|
||||
before_action :member_only, except: [:index]
|
||||
respond_to :html, :xml, :json, :js
|
||||
skip_before_action :api_check
|
||||
rescue_with Favorite::Error, status: 422
|
||||
|
||||
def index
|
||||
if params[:tags]
|
||||
|
||||
Reference in New Issue
Block a user