From eef37939d8fb3ede1d5bff629db21d1b0e5f48a7 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Mon, 16 Dec 2024 11:46:43 -0800 Subject: [PATCH] use separate variable for error_info list vs dict --- google/api_core/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google/api_core/exceptions.py b/google/api_core/exceptions.py index 5b25d124..e3eb696c 100644 --- a/google/api_core/exceptions.py +++ b/google/api_core/exceptions.py @@ -517,14 +517,14 @@ def format_http_response_error( errors = payload.get("error", {}).get("errors", ()) # In JSON, details are already formatted in developer-friendly way. details = payload.get("error", {}).get("details", ()) - error_info = list( + error_info_list = list( filter( lambda detail: detail.get("@type", "") == "type.googleapis.com/google.rpc.ErrorInfo", details, ) ) - error_info = error_info[0] if error_info else None + error_info = error_info_list[0] if error_info_list else None message = _format_rest_error_message(error_message, method, url) exception = from_http_status(