PATH:
opt
/
imunify360
/
venv
/
lib
/
python3.11
/
site-packages
/
sentry_sdk
/
integrations
import sys from sentry_sdk.hub import Hub from sentry_sdk.utils import capture_internal_exceptions, event_from_exception from sentry_sdk.integrations import Integration from sentry_sdk._types import MYPY if MYPY: from typing import Callable from typing import Any from typing import Type from types import TracebackType Excepthook = Callable[ [Type[BaseException], BaseException, TracebackType], Any, ] class ExcepthookIntegration(Integration): identifier = "excepthook" always_run = False def __init__(self, always_run=False): # type: (bool) -> None if not isinstance(always_run, bool): raise ValueError( "Invalid value for always_run: %s (must be type boolean)" % (always_run,) ) self.always_run = always_run @staticmethod def setup_once(): # type: () -> None sys.excepthook = _make_excepthook(sys.excepthook) def _make_excepthook(old_excepthook): # type: (Excepthook) -> Excepthook def sentry_sdk_excepthook(type_, value, traceback): # type: (Type[BaseException], BaseException, TracebackType) -> None hub = Hub.current integration = hub.get_integration(ExcepthookIntegration) if integration is not None and _should_send(integration.always_run): # If an integration is there, a client has to be there. client = hub.client # type: Any with capture_internal_exceptions(): event, hint = event_from_exception( (type_, value, traceback), client_options=client.options, mechanism={"type": "excepthook", "handled": False}, ) hub.capture_event(event, hint=hint) return old_excepthook(type_, value, traceback) return sentry_sdk_excepthook def _should_send(always_run=False): # type: (bool) -> bool if always_run: return True if hasattr(sys, "ps1"): # Disable the excepthook for interactive Python shells, otherwise # every typo gets sent to Sentry. return False return True
[-] celery.py
[edit]
[-] redis.py
[edit]
[-] rq.py
[edit]
[-] falcon.py
[edit]
[+]
..
[-] gnu_backtrace.py
[edit]
[-] trytond.py
[edit]
[-] wsgi.py
[edit]
[-] serverless.py
[edit]
[-] executing.py
[edit]
[-] sanic.py
[edit]
[-] sqlalchemy.py
[edit]
[-] atexit.py
[edit]
[-] gcp.py
[edit]
[-] dedupe.py
[edit]
[+]
__pycache__
[-] threading.py
[edit]
[-] asgi.py
[edit]
[-] boto3.py
[edit]
[-] aws_lambda.py
[edit]
[-] modules.py
[edit]
[-] stdlib.py
[edit]
[-] tornado.py
[edit]
[-] beam.py
[edit]
[-] logging.py
[edit]
[-] pure_eval.py
[edit]
[-] flask.py
[edit]
[+]
spark
[-] aiohttp.py
[edit]
[-] __init__.py
[edit]
[-] argv.py
[edit]
[-] chalice.py
[edit]
[+]
django
[-] bottle.py
[edit]
[-] _wsgi_common.py
[edit]
[-] pyramid.py
[edit]
[-] excepthook.py
[edit]