o
    h                     @   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 )TrytondWSGIIntegrationtrytond_wsgic                 C   s   d S N )selfr	   r	   b/var/www/html/aiguide_backend/venv/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 )NtrytondF)typehandled)client_options	mechanism)hint)
sentry_sdkhubHubcurrentget_integrationr   
isinstancer   clientutilsevent_from_exceptionoptions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   integrationswsgiSentryWsgiMiddlewarer   wsgi_apphasattrr    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   )sentry_sdk.hubr   sentry_sdk.utilssentry_sdk.integrationssentry_sdk.integrations.wsgisentry_sdk._typesr   trytond.exceptionsr   trytond.wsgir   typingr   r$   Integrationr   r	   r	   r	   r   <module>   s    