From 120456dbbb63f5706f864757531b1644fefd6120 Mon Sep 17 00:00:00 2001 From: Kiran R <71453237+kiran2706@users.noreply.github.com> Date: Tue, 27 May 2025 21:08:05 +0530 Subject: [PATCH] BugFix(SDKError): Correct error formatting in SDKError __str__ method (#1587) ### BugFix: Correct error formatting in SDKError.__str__ #### Problem Calling `str(SDKError)` raised the following runtime error: `looker_sdk.error.SDKError: ` This happened when the SDK attempted to convert the error to a string, which failed due to a malformed generator expression or naming conflict during the formatting of `self.errors`. #### Fix Updated the loop variable in the generator expression from `error` to `error_details` to: - Avoid potential name shadowing. - Improve clarity and correctness of the `__str__` implementation. - Resolve the runtime error so the error can now be printed correctly. #### Notes - The variable `error_details` represents a single instance; per PEP 8, we may later rename it to `error_detail` for readability. --- python/looker_sdk/error.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/looker_sdk/error.py b/python/looker_sdk/error.py index 5d925af84..b4d773939 100644 --- a/python/looker_sdk/error.py +++ b/python/looker_sdk/error.py @@ -82,7 +82,7 @@ def __str__(self): documentation_url: {self.documentation_url} error_doc_url: {self.error_doc_url} error details: - {sep.join(str(error) for error in self.errors)} + {sep.join(str(error_details) for error_details in self.errors)} """