Skip to content

Commit c3a9d1e

Browse files
authored
fix: Potentially uncaught exception in access token request (#16)
1 parent bb936e9 commit c3a9d1e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

laceworksdk/http_session.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ def _get_access_token(self):
151151
"expiryTime": DEFAULT_ACCESS_TOKEN_EXPIRATION
152152
}
153153

154+
response = None
155+
154156
try:
155157
response = self._session.post(uri, json=data, headers=headers)
156158

@@ -160,7 +162,11 @@ def _get_access_token(self):
160162
self._print_debug_response(response)
161163

162164
except Exception:
163-
raise ApiError(response)
165+
if response:
166+
raise ApiError(response)
167+
168+
logger.error("Call to _get_access_token() returned no response.")
169+
raise
164170

165171
return response
166172

0 commit comments

Comments
 (0)