Skip to content

Commit 4a4a99f

Browse files
committed
MOD: Suppress exception chains for BentoError
1 parent 657cdda commit 4a4a99f

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

databento/common/dbnstore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ def __next__(self) -> np.ndarray[Any, Any]:
13191319
except ValueError:
13201320
raise BentoError(
13211321
"DBN file is truncated or contains an incomplete record",
1322-
)
1322+
) from None
13231323

13241324

13251325
class DataFrameIterator:

databento/historical/api/batch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def _download_file(
376376
for chunk in response.iter_content(chunk_size=None):
377377
f.write(chunk)
378378
except Exception as exc:
379-
raise BentoError(f"Error downloading file: {exc}")
379+
raise BentoError(f"Error downloading file: {exc}") from None
380380
logger.debug("Download of %s completed", output_path.name)
381381

382382
async def download_async(
@@ -521,7 +521,7 @@ async def _download_file_async(
521521
data: bytes = chunk[0]
522522
f.write(data)
523523
except Exception as exc:
524-
raise BentoError(f"Error downloading file: {exc}")
524+
raise BentoError(f"Error downloading file: {exc}") from None
525525
logger.debug("Download of %s completed", output_path.name)
526526

527527
def _get_file_download_headers_and_mode(

databento/historical/http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _stream(
137137
for chunk in response.iter_content(chunk_size=None):
138138
writer.write(chunk)
139139
except Exception as exc:
140-
raise BentoError(f"Error streaming response: {exc}")
140+
raise BentoError(f"Error streaming response: {exc}") from None
141141

142142
if path is None:
143143
writer.seek(0)
@@ -177,7 +177,7 @@ async def _stream_async(
177177
async for chunk in response.content.iter_chunks():
178178
writer.write(chunk[0])
179179
except Exception as exc:
180-
raise BentoError(f"Error streaming response: {exc}")
180+
raise BentoError(f"Error streaming response: {exc}") from None
181181

182182
if path is None:
183183
writer.seek(0)

databento/live/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,12 @@ async def wait_for_close(self) -> None:
414414
try:
415415
self._protocol.authenticated.result()
416416
except Exception as exc:
417-
raise BentoError(exc)
417+
raise BentoError(exc) from None
418418

419419
try:
420420
self._protocol.disconnected.result()
421421
except Exception as exc:
422-
raise BentoError(exc)
422+
raise BentoError(exc) from None
423423

424424
self._protocol = self._transport = None
425425

0 commit comments

Comments
 (0)