o
    Zh                     @   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r*d dlmZ G dd dejjZdS )    N)TYPE_CHECKING)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   V/var/www/html/lang_env/lib/python3.10/site-packages/sentry_sdk/integrations/trytond.py__init__   s   zTrytondWSGIIntegration.__init__c                     sJ   t jjtjt_dd  ttdrtj fdd} d S 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
   _1   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    