about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-10-27 14:30:52 +0200
committerGitHub <noreply@github.com>2022-10-27 14:30:52 +0200
commit3e18e05330ac8c1101845db650d7cd62b0fa8260 (patch)
tree2b50a161fa1d290c20d50c8cf54a899e1461f317 /app/controllers
parentd2eb726962187226c85ef7f2ee1886cb0767bbd1 (diff)
Fix uncaught error when invalid date is supplied to API (#19480)
Fix #19213
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/base_controller.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb
index 7ce6599c5..c46fde65b 100644
--- a/app/controllers/api/base_controller.rb
+++ b/app/controllers/api/base_controller.rb
@@ -24,6 +24,10 @@ class Api::BaseController < ApplicationController
     render json: { error: 'Duplicate record' }, status: 422
   end
 
+  rescue_from Date::Error do
+    render json: { error: 'Invalid date supplied' }, status: 422
+  end
+
   rescue_from ActiveRecord::RecordNotFound do
     render json: { error: 'Record not found' }, status: 404
   end