Skip to content

Commit a91f144

Browse files
reduce verbosity
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 325b68e commit a91f144

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/databricks/sql/backend/utils/http_client.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,31 +142,29 @@ def _make_request(
142142
return {}
143143

144144
except requests.exceptions.RequestException as e:
145-
# Handle request errors
145+
# Handle request errors and extract details from response if available
146146
error_message = f"SEA HTTP request failed: {str(e)}"
147-
logger.error(error_message)
148147

149-
# Extract error details from response if available
150148
if hasattr(e, "response") and e.response is not None:
149+
status_code = e.response.status_code
151150
try:
152151
error_details = e.response.json()
153152
error_message = (
154153
f"{error_message}: {error_details.get('message', '')}"
155154
)
156155
logger.error(
157-
f"Response status: {e.response.status_code}, Error details: {error_details}"
156+
f"Request failed (status {status_code}): {error_details}"
158157
)
159158
except (ValueError, KeyError):
160-
# If we can't parse the JSON, just log the raw content
161-
content_str = (
159+
# If we can't parse JSON, log raw content
160+
content = (
162161
e.response.content.decode("utf-8", errors="replace")
163162
if isinstance(e.response.content, bytes)
164163
else str(e.response.content)
165164
)
166-
logger.error(
167-
f"Response status: {e.response.status_code}, Raw content: {content_str}"
168-
)
169-
pass
165+
logger.error(f"Request failed (status {status_code}): {content}")
166+
else:
167+
logger.error(error_message)
170168

171169
# Re-raise as a RequestError
172170
from databricks.sql.exc import RequestError

0 commit comments

Comments
 (0)