o
    ß­j4  ã                   @   s²   d dl mZ d dlmZmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZmZ d dlmZmZ d	ed
e
defdd„Zd	ed
edefdd„Zded
eddfdd„ZdS )é    )Újsonable_encoder)ÚRequestValidationErrorÚWebSocketRequestValidationError)Úis_body_allowed_for_status_code)Ú	WebSocket)ÚHTTPException)ÚRequest)ÚJSONResponseÚResponse)ÚHTTP_422_UNPROCESSABLE_ENTITYÚWS_1008_POLICY_VIOLATIONÚrequestÚexcÚreturnc                 Ã   s<   �t |dd ƒ}t|jƒst|j|d�S td|ji|j|d�S )NÚheaders)Ústatus_coder   Údetail)Úgetattrr   r   r
   r	   r   )r   r   r   © r   úW/var/www/html/CropPilot/venv/lib/python3.10/site-packages/fastapi/exception_handlers.pyÚhttp_exception_handler   s   €
ÿr   c                 Ã   s   �t tdt| ¡ ƒid�S )Nr   )r   Úcontent)r	   r   r   Úerrors)r   r   r   r   r   Ú$request_validation_exception_handler   s
   €þr   Ú	websocketNc                 Ã   s"   �| j tt| ¡ ƒd�I d H  d S )N)ÚcodeÚreason)Úcloser   r   r   )r   r   r   r   r   Ú.websocket_request_validation_exception_handler   s   €ÿr   )Úfastapi.encodersr   Úfastapi.exceptionsr   r   Úfastapi.utilsr   Úfastapi.websocketsr   Ústarlette.exceptionsr   Ústarlette.requestsr   Ústarlette.responsesr	   r
   Ústarlette.statusr   r   r   r   r   r   r   r   r   Ú<module>   s.    	ÿÿ
þ	ÿÿþ