a
    xd                     @   sl   d dl Zd dlZd dlZd dlZd dlmZ d dlmZ d dl	m
Z
 erTd dlmZ G dd dejjZdS )    N)MYPY)TrytonException)app)Anyc                   @   s$   e Zd ZdZdd Zedd ZdS )TrytondWSGIIntegrationZtrytond_wsgic                 C   s   d S N )selfr   r   W/var/www/html/Ranjet/env/lib/python3.9/site-packages/sentry_sdk/integrations/trytond.py__init__   s    zTrytondWSGIIntegration.__init__c                     sH   t jjtjt_dd  ttdr8tj fdd} ntj	  d S )Nc                 S   s`   t jjj}|td u rd S t| tr*d S |j}t j	j
| |jdddd\}}|j||d d S )NZtrytondF)typeZhandled)Zclient_optionsZ	mechanism)hint)
sentry_sdkhubZHubcurrentZget_integrationr   
isinstancer   clientutilsZevent_from_exceptionoptionsZcapture_event)er   r   eventr   r   r   r
   error_handler   s    


z8TrytondWSGIIntegration.setup_once.<locals>.error_handlerr   c                    s    | d S r   r   )r   requestr   r   r   r
   _2   s    z,TrytondWSGIIntegration.setup_once.<locals>._)
r   integrationsZwsgiZSentryWsgiMiddlewarer   Zwsgi_apphasattrr   Zerror_handlersappend)r   r   r   r
   
setup_once   s    
z!TrytondWSGIIntegration.setup_onceN)__name__
__module____qualname__
identifierr   staticmethodr   r   r   r   r
   r      s   r   )Zsentry_sdk.hubr   Zsentry_sdk.utilsZsentry_sdk.integrationsZsentry_sdk.integrations.wsgiZsentry_sdk._typesr   Ztrytond.exceptionsr   Ztrytond.wsgir   typingr   r   ZIntegrationr   r   r   r   r
   <module>   s   