@@ -155,7 +155,6 @@ def __init__(self, api_version):
155155 self ._error_protos = None
156156 self ._failure_key = (
157157 f'google.ads.googleads.{ api_version } .errors.googleadsfailure-bin' )
158- self ._exception = None
159158 self ._api_version = api_version
160159
161160 def _get_error_from_response (self , response ):
@@ -182,9 +181,6 @@ def _get_error_from_response(self, response):
182181 Exception: If not a GoogleAdsException or RpcException the error
183182 will be raised as-is.
184183 """
185- if self ._exception :
186- return self ._exception
187-
188184 status_code = response .code ()
189185 response_exception = response .exception ()
190186
@@ -200,20 +196,19 @@ def _get_error_from_response(self, response):
200196 # library-specific Error type for easy handling. These errors
201197 # originate from the Google Ads API and are often caused by
202198 # invalid requests.
203- self . _exception = GoogleAdsException (
199+ return GoogleAdsException (
204200 response_exception , response , google_ads_failure ,
205201 request_id )
206202 else :
207203 # Raise the original exception if not a GoogleAdsFailure. This
208204 # type of error is generally caused by problems at the request
209205 # level, such as when an invalid endpoint is given.
210- self . _exception = response_exception
206+ return response_exception
211207 else :
212208 # Raise the original exception if error has status code
213209 # INTERNAL or RESOURCE_EXHAUSTED, meaning that
214- self . _exception = response_exception
210+ return response_exception
215211
216- return self ._exception
217212
218213 def _get_google_ads_failure (self , trailing_metadata ):
219214 """Gets the Google Ads failure details if they exist.
0 commit comments