Fix uncaught 500 error on invalid replies_policy (Fix #19097) (#20126)

This commit is contained in:
trwnh 2022-11-08 09:37:28 -06:00 committed by GitHub
parent c989faaa62
commit 68d9dcd425
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,10 @@ class Api::V1::ListsController < Api::BaseController
before_action :require_user! before_action :require_user!
before_action :set_list, except: [:index, :create] before_action :set_list, except: [:index, :create]
rescue_from ArgumentError do |e|
render json: { error: e.to_s }, status: 422
end
def index def index
@lists = List.where(account: current_account).all @lists = List.where(account: current_account).all
render json: @lists, each_serializer: REST::ListSerializer render json: @lists, each_serializer: REST::ListSerializer