All checks were successful
Build-Release-Image / Build-Image (linux/amd64) (push) Successful in 3m29s
Build-Release-Image / Build-Image (linux/arm64) (push) Successful in 3m33s
Build-Release-Image / Merge-Images (push) Successful in 44s
Build-Release-Image / Create-Release (push) Successful in 7s
Build-Release-Image / Notify (push) Successful in 20s
22 lines
638 B
Python
22 lines
638 B
Python
from typing import Optional
|
|
|
|
from sentry_sdk.types import Event, Hint
|
|
|
|
_HTTP_CODES_TO_IGNORE = [416]
|
|
|
|
|
|
def _should_send(_event: Event, hint: Hint) -> bool:
|
|
# Check if this is an HTTP Exception event
|
|
if "exc_info" in hint:
|
|
exc_type, exc_value, exc_traceback = hint["exc_info"]
|
|
# Check if it's a Werkzeug HTTPException (raised for HTTP status codes)
|
|
if hasattr(exc_value, "code") and exc_value.code in _HTTP_CODES_TO_IGNORE:
|
|
return False
|
|
return True
|
|
|
|
|
|
def sentry_before_send(event: Event, hint: Hint) -> Optional[Event]:
|
|
if _should_send(event, hint):
|
|
return event
|
|
return None
|