Skip to content

Commit

Permalink
Add logging to _send_request_safe_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Baldwin committed Nov 1, 2023
1 parent d68a6fc commit 8d5d1f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion locust/clients.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import re
import time
import logging
from contextlib import contextmanager
from typing import Generator, Optional
from urllib.parse import urlparse, urlunparse
Expand All @@ -16,6 +17,8 @@

absolute_http_url_regexp = re.compile(r"^https?://", re.I)

logger = logging.getLogger(__name__)


class LocustResponse(Response):
def raise_for_status(self):
Expand Down Expand Up @@ -178,7 +181,8 @@ def _send_request_safe_mode(self, method, url, **kwargs):
"""
try:
return super().request(method, url, **kwargs)
except (MissingSchema, InvalidSchema, InvalidURL):
except (MissingSchema, InvalidSchema, InvalidURL) as e:
logger.log(logging.CRITICAL, str(e))
raise
except RequestException as e:
r = LocustResponse()
Expand Down

0 comments on commit 8d5d1f4

Please sign in to comment.