Skip to content

Commit 82e25d3

Browse files
improve warning message
1 parent 7997870 commit 82e25d3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

sentry_sdk/tracing.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,14 +982,29 @@ def _in_http_status_code_range(self, code, code_ranges):
982982
wrong_type_message = "trace_ignore_status_codes must be a list of integers or pairs of integers."
983983
try:
984984
low, high = target
985-
if not isinstance(low, int) or not isinstance(high, int):
985+
if (
986+
isinstance(code, int)
987+
and not isinstance(low, int)
988+
or not isinstance(high, int)
989+
):
986990
logger.warning(wrong_type_message)
987991
continue
992+
elif not isinstance(code, int):
993+
logger.warning(
994+
f"Invalid type for http.request.status_code; is {code!r} of type {type(code)}, expected an int."
995+
)
996+
continue
988997

989998
if low <= code <= high:
990999
return True
9911000

9921001
except Exception:
1002+
if not isinstance(code, int):
1003+
logger.warning(
1004+
f"Invalid type for http.request.status_code; is {code!r} of type {type(code)}, expected an int."
1005+
)
1006+
continue
1007+
9931008
logger.warning(wrong_type_message)
9941009

9951010
return False

0 commit comments

Comments
 (0)