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:
parent
d4079070ed
commit
4edaebb94f
2 changed files with 2 additions and 2 deletions
|
|
@ -37,7 +37,7 @@ module Api
|
||||||
|
|
||||||
rescue_from ActionController::ParameterMissing do |e|
|
rescue_from ActionController::ParameterMissing do |e|
|
||||||
logger.error e.message
|
logger.error e.message
|
||||||
render_error 422, "Parameters missing or invalid: #{e.message}"
|
render_error 422, e.message.split("\n").first
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_user
|
def current_user
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ module Api
|
||||||
require_access_token %w[public:read]
|
require_access_token %w[public:read]
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue_from ActionController::ParameterMissing, RuntimeError do |e|
|
rescue_from RuntimeError do |e|
|
||||||
render_error 422, e.message
|
render_error 422, e.message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue