mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Fix uncaught error when invalid date is supplied to API (#19480)
Fix #19213
This commit is contained in:
parent
d2eb726962
commit
3e18e05330
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user