Skip to content

Commit

Permalink
Merge pull request #937 from blacklanternsecurity/less-http-debugging
Browse files Browse the repository at this point in the history
Less traceback logging for failed http requests
  • Loading branch information
TheTechromancer authored Dec 24, 2023
2 parents 61dfc0b + 50a40c1 commit 9021130
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bbot/core/helpers/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import ssl
import anyio
import httpx
import asyncio
import logging
import warnings
import traceback
Expand Down Expand Up @@ -616,8 +617,12 @@ async def _acatch(self, url, raise_error):
if raise_error:
raise httpx.RequestError(msg)
except BaseException as e:
log.trace(f"Unhandled exception with request to URL: {url}: {e}")
log.trace(traceback.format_exc())
# don't log if the error is the result of an intentional cancellation
if not any(
isinstance(_e, asyncio.exceptions.CancelledError) for _e in self.parent_helper.get_exception_chain(e)
):
log.trace(f"Unhandled exception with request to URL: {url}: {e}")
log.trace(traceback.format_exc())
raise


Expand Down

0 comments on commit 9021130

Please sign in to comment.