0
0
Fork 0

Fix uncaught parameter missing exceptions and missing error templates (#11702)

This commit is contained in:
Eugen Rochko 2019-08-30 01:34:47 +02:00 committed by GitHub
parent 8ee4a2892c
commit 22ce4778eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 41 additions and 3 deletions

View file

@ -36,6 +36,14 @@ class Api::BaseController < ApplicationController
render json: { error: 'This action is not allowed' }, status: 403
end
rescue_from Mastodon::RaceConditionError do
render json: { error: 'There was a temporary problem serving your request, please try again' }, status: 503
end
rescue_from ActionController::ParameterMissing do |e|
render json: { error: e.to_s }, status: 400
end
def doorkeeper_unauthorized_render_options(error: nil)
{ json: { error: (error.try(:description) || 'Not authorized') } }
end