From 73931b1077dbf1f6cb195dfc427b1a7a6fe89a33 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Tue, 5 Sep 2023 16:46:54 -0400 Subject: [PATCH] 20750/20927: Add TODO about network error handling The commit message for 9717f88d29310067fa70e19fb9afb3679c036bc4 says: > This may also provide better behavior in cases of network hiccups or > other remote server turbulence. This was written with the expectation that those problems would raise `HTTPClient::BadResponseError`. That was mistaken. Those problems actually raise lower-level socket exceptions instead. We now have a ticket to improve the error handling here. It's out of scope for #20750, since the error handling is no worse than it was before the branch. Arvados-DCO-1.1-Signed-off-by: Brett Smith --- services/api/app/models/api_client_authorization.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb index 19d3cc687f..c149ffc329 100644 --- a/services/api/app/models/api_client_authorization.rb +++ b/services/api/app/models/api_client_authorization.rb @@ -301,6 +301,8 @@ class ApiClientAuthorization < ArvadosModel self.res.status_code end raise + # TODO #20927: Catch network exceptions and assign a 5xx status to them so + # the client knows they're a temporary problem. rescue => e Rails.logger.warn "error getting remote token details for #{token.inspect}: #{e}" return nil @@ -336,6 +338,8 @@ class ApiClientAuthorization < ArvadosModel end raise end + # TODO #20927: Catch network exceptions and assign a 5xx status to them so + # the client knows they're a temporary problem. rescue => e Rails.logger.warn "getting remote user with token #{token.inspect} failed: #{e}" else -- 2.39.5