Skip to content

Commit 986d8b8

Browse files
authored
fix: preserve stack traces in error logging (#283)
1 parent 8271df1 commit 986d8b8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/unstructured_client/_hooks/custom/logger_hook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ def after_error(
8181
if response:
8282
logger.error("Server responded with %d - %s", response.status_code, response.text)
8383
if error is not None:
84-
logger.error("Following error occurred - %s", error)
84+
logger.error("Following error occurred - %s", error, exc_info=error)
8585
return response, error

src/unstructured_client/_hooks/custom/request_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ async def do_request():
182182
)
183183
return response
184184
except Exception as e:
185-
print(e)
185+
logger.error("Request failed with error", exc_info=e)
186186
raise e
187187
finally:
188188
if not isinstance(pdf_chunk_file, io.BytesIO) and not pdf_chunk_file.closed:

0 commit comments

Comments
 (0)