diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-10-27 14:30:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 14:30:52 +0200 |
commit | 3e18e05330ac8c1101845db650d7cd62b0fa8260 (patch) | |
tree | 2b50a161fa1d290c20d50c8cf54a899e1461f317 /app | |
parent | d2eb726962187226c85ef7f2ee1886cb0767bbd1 (diff) |
Fix uncaught error when invalid date is supplied to API (#19480)
Fix #19213
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api/base_controller.rb | 4 |
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 |