Skip to content
Snippets Groups Projects
Unverified Commit 3e18e053 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix uncaught error when invalid date is supplied to API (#19480)

Fix #19213
parent d2eb7269
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,10 @@ class Api::BaseController < ApplicationController ...@@ -24,6 +24,10 @@ class Api::BaseController < ApplicationController
render json: { error: 'Duplicate record' }, status: 422 render json: { error: 'Duplicate record' }, status: 422
end end
rescue_from Date::Error do
render json: { error: 'Invalid date supplied' }, status: 422
end
rescue_from ActiveRecord::RecordNotFound do rescue_from ActiveRecord::RecordNotFound do
render json: { error: 'Record not found' }, status: 404 render json: { error: 'Record not found' }, status: 404
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment