Remove "Did you mean?" from api errors when a parameter is missing

This isn't helpful at all for an api if you don't send a required
parameter and get an error response that just tells you what parameters
that were available.

This is a new feature with rails >= 6.1 and ruby >= 2.7, so this just
keeps the old behaviour of older rails/ruby versions.
This commit is contained in:
Benjamin Neff 2022-07-17 17:42:12 +02:00
parent d4079070ed
commit 4edaebb94f
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 2 additions and 2 deletions

View file

@ -37,7 +37,7 @@ module Api
rescue_from ActionController::ParameterMissing do |e|
logger.error e.message
render_error 422, "Parameters missing or invalid: #{e.message}"
render_error 422, e.message.split("\n").first
end
def current_user

View file

@ -15,7 +15,7 @@ module Api
require_access_token %w[public:read]
end
rescue_from ActionController::ParameterMissing, RuntimeError do |e|
rescue_from RuntimeError do |e|
render_error 422, e.message
end