From dd92b1abd2ed91e2d29ae2c7c461530ef856a956 Mon Sep 17 00:00:00 2001 From: ulferts Date: Fri, 21 Jun 2024 15:46:29 +0200 Subject: [PATCH] bump grape --- Gemfile | 2 +- Gemfile.lock | 17 +++++++---------- lib/api/root.rb | 2 +- lib/api/utilities/grape_helper.rb | 6 +++++- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 35b9e21a8ad..7c912370a31 100644 --- a/Gemfile +++ b/Gemfile @@ -349,7 +349,7 @@ end gem "bootsnap", "~> 1.18.0", require: false # API gems -gem "grape", "~> 2.0.0" +gem "grape", "~> 2.1.0" gem "grape_logging", "~> 1.8.4" gem "roar", "~> 1.2.0" diff --git a/Gemfile.lock b/Gemfile.lock index ba216ee21a8..b8d1335890f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -591,13 +591,12 @@ GEM multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) - grape (2.0.0) - activesupport (>= 5) - builder + grape (2.1.0) + activesupport (>= 6) dry-types (>= 1.1) - mustermann-grape (~> 1.0.0) - rack (>= 1.3.0) - rack-accept + mustermann-grape (~> 1.1.0) + rack (>= 2) + zeitwerk grape_logging (1.8.4) grape rack @@ -729,7 +728,7 @@ GEM multi_json (1.15.0) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - mustermann-grape (1.0.2) + mustermann-grape (1.1.0) mustermann (>= 1.0.0) mutex_m (0.2.0) net-http (0.4.1) @@ -845,8 +844,6 @@ GEM raabro (1.4.0) racc (1.8.0) rack (2.2.9) - rack-accept (0.4.5) - rack (>= 0.4) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-cors (2.0.2) @@ -1211,7 +1208,7 @@ DEPENDENCIES good_job (= 3.26.2) google-apis-gmail_v1 googleauth - grape (~> 2.0.0) + grape (~> 2.1.0) grape_logging (~> 1.8.4) grids! html-pipeline (~> 2.14.0) diff --git a/lib/api/root.rb b/lib/api/root.rb index 2fa907550da..66f5067b387 100644 --- a/lib/api/root.rb +++ b/lib/api/root.rb @@ -44,7 +44,7 @@ module API api_error = ::API::Errors::Unauthenticated.new error_message representer = ::API::V3::Errors::ErrorRepresenter.new api_error - e.error_response status: 401, message: representer.to_json, headers: warden.headers, log: false + e.error! representer.to_json, 401, warden.headers end version "v3", using: :path do diff --git a/lib/api/utilities/grape_helper.rb b/lib/api/utilities/grape_helper.rb index 26a364e5bd6..e2c37f8e7cb 100644 --- a/lib/api/utilities/grape_helper.rb +++ b/lib/api/utilities/grape_helper.rb @@ -38,6 +38,10 @@ module API @env = env @options = {} end + + def error!(message, status = nil, headers = nil, backtrace = nil, original_exception = nil) + super + end end def grape_error_for(env, api) @@ -75,7 +79,7 @@ module API log.call(original_exception) end - error_response status: e.code, message: representer.to_json, headers: resp_headers + error!(representer.to_json, e.code, resp_headers) } end end