about summary refs log tree commit diff
path: root/app/controllers/api
diff options
context:
space:
mode:
authortrwnh <a@trwnh.com>2022-11-08 09:37:28 -0600
committerGitHub <noreply@github.com>2022-11-08 16:37:28 +0100
commit68d9dcd425468a4b2cca46de7de462eaa27c80f0 (patch)
treeaf14df54c46c402d8daa145c649210fed3b3a021 /app/controllers/api
parentc989faaa6201f19e99dc7088a496e603153f0f90 (diff)
Fix uncaught 500 error on invalid `replies_policy` (Fix #19097) (#20126)
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/lists_controller.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/api/v1/lists_controller.rb b/app/controllers/api/v1/lists_controller.rb
index e5ac45fef..843ca2ec2 100644
--- a/app/controllers/api/v1/lists_controller.rb
+++ b/app/controllers/api/v1/lists_controller.rb
@@ -7,6 +7,10 @@ class Api::V1::ListsController < Api::BaseController
   before_action :require_user!
   before_action :set_list, except: [:index, :create]
 
+  rescue_from ArgumentError do |e|
+    render json: { error: e.to_s }, status: 422
+  end
+
   def index
     @lists = List.where(account: current_account).all
     render json: @lists, each_serializer: REST::ListSerializer