Skip to content

Commit 3e7c9ae

Browse files
committed
fix: add from e to exception chaining for B904
1 parent e5156f7 commit 3e7c9ae

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

stableops/http.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def request(
248248
status=status,
249249
code=error_data.get("code", "api_error"),
250250
details=error_data.get("details"),
251-
)
251+
) from e
252252

253253
# Retry on 429 and 5xx
254254
if attempt < self.max_retries and is_retryable_status(status):
@@ -264,7 +264,7 @@ def request(
264264
status=status,
265265
code=error_data.get("code", "api_error"),
266266
details=error_data.get("details"),
267-
)
267+
) from e
268268

269269
except (httpx.TimeoutException, httpx.NetworkError) as e:
270270
if self._debug:
@@ -291,7 +291,7 @@ def request(
291291
status=0,
292292
code=error_type,
293293
details=None,
294-
)
294+
) from e
295295

296296
# Should never reach here
297297
raise StableOpsError(
@@ -450,7 +450,7 @@ async def request(
450450
status=status,
451451
code=error_data.get("code", "api_error"),
452452
details=error_data.get("details"),
453-
)
453+
) from e
454454

455455
if attempt < self.max_retries and is_retryable_status(status):
456456
retry_after = self._parse_retry_after(e.response)
@@ -464,7 +464,7 @@ async def request(
464464
status=status,
465465
code=error_data.get("code", "api_error"),
466466
details=error_data.get("details"),
467-
)
467+
) from e
468468

469469
except (httpx.TimeoutException, httpx.NetworkError) as e:
470470
if self._debug:
@@ -489,7 +489,7 @@ async def request(
489489
status=0,
490490
code=error_type,
491491
details=None,
492-
)
492+
) from e
493493

494494
raise StableOpsError(
495495
message="Max retries exceeded",

0 commit comments

Comments
 (0)