Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBenjamin Neff <benjamin@coding4coffee.ch>2022-07-17 18:42:12 +0300
committerBenjamin Neff <benjamin@coding4coffee.ch>2022-07-20 22:35:02 +0300
commit4edaebb94f10bb3ab616398ff89c27820dfaef9d (patch)
tree701cb97e40cd4fff64018ecef01fddef7e46e14d /app
parentd4079070edc8b750257fffe5da9b0494504d5576 (diff)
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.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/v1/base_controller.rb2
-rw-r--r--app/controllers/api/v1/search_controller.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/api/v1/base_controller.rb b/app/controllers/api/v1/base_controller.rb
index b4e80b6f5..0097eee61 100644
--- a/app/controllers/api/v1/base_controller.rb
+++ b/app/controllers/api/v1/base_controller.rb
@@ -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
diff --git a/app/controllers/api/v1/search_controller.rb b/app/controllers/api/v1/search_controller.rb
index 0f324099b..c769cfda5 100644
--- a/app/controllers/api/v1/search_controller.rb
+++ b/app/controllers/api/v1/search_controller.rb
@@ -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