� L�g� ���ddlmZddlZddlmZmZmZddlmZm Z ddl m Z ddl m Z mZddlmZmZmZmZddlmZGd �d ��ZdS) �)� annotationsN)�ExceptionHandlers�StatusHandlers�wrap_app_handling_exceptions)� HTTPException�WebSocketException)�Request)�PlainTextResponse�Response)�ASGIApp�Receive�Scope�Send)� WebSocketc�<�eZdZ d!d"d �Zd#d�Zd$d�Zd%d�Zd&d �ZdS)'�ExceptionMiddlewareNF�appr �handlers�Rtyping.Mapping[typing.Any, typing.Callable[[Request, Exception], Response]] | None�debug�bool�return�Nonec���||_||_i|_t|jt |ji|_|�0|���D]\}}|� ||���dSdS�N) rr�_status_handlersr�http_exceptionr�websocket_exception�_exception_handlers�items�add_exception_handler)�selfrrr�key�values �o/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/starlette/middleware/exceptions.py�__init__zExceptionMiddleware.__init__s��� ����� �02��� �4�.� �� 8�7 �� � � �&�n�n�.�.� 7� 7� ��U��*�*�3��6�6�6�6� � � 7� 7��exc_class_or_status_code�int | type[Exception]�handler�/typing.Callable[[Request, Exception], Response]c��t|t��r ||j|<dSt|t��sJ�||j|<dSr)� isinstance�intr� issubclass� Exceptionr)r"r(r*s r%r!z)ExceptionMiddleware.add_exception_handler#sW�� �.�� 4� 4� I�>E�D� !�":� ;� ;� ;��6� �B�B� B� B�B�AH�D� $�%=� >� >� >r'�scoper�receiver �sendrc��(K�|ddvr|�|||���d{V��dS|j|jf|d<|ddkrt|||��}nt |||��}t |j|��|||���d{V��dS)N�type)�http� websocketzstarlette.exception_handlersr6)rrrr rr)r"r1r2r3�conns r%�__call__zExceptionMiddleware.__call__.s����� ��=� 5� 5� 5��(�(�5�'�4�0�0� 0� 0� 0� 0� 0� 0� 0� �F� � $� � !�1 ��,�-� ��=�F� "� "��5�'�4�0�0�D�D��U�G�T�2�2�D�:�*�4�8�T�:�:�5�'�4�P�P�P�P�P�P�P�P�P�P�Pr'�requestr �excr0r c��t|t��sJ�|jdvrt|j|j���St |j|j|j���S)N>�0��)� status_code�headers)r-rr?r r@r �detail)r"r:r;s r%rz"ExceptionMiddleware.http_exception@sY���#�}�-�-�-�-�-� �?�j� (� (������M�M�M� M� �����RU�R]�^�^�^�^r'r7rc��K�t|t��sJ�|�|j|j����d{V��dS)N)�code�reason)r-r�closerCrD)r"r7r;s r%rz'ExceptionMiddleware.websocket_exceptionFsO�����#�1�2�2�2�2�2��o�o�3�8�C�J�o�?�?�?�?�?�?�?�?�?�?�?r')NF)rr rrrrrr)r(r)r*r+rr)r1rr2r r3rrr)r:r r;r0rr )r7rr;r0rr)�__name__� __module__� __qualname__r&r!r9rr�r'r%rrs�������hl�� 7�7�7�7�7�" I� I� I� I�Q�Q�Q�Q�$_�_�_�_� @�@�@�@�@�@r'r)� __future__r�typing�starlette._exception_handlerrrr�starlette.exceptionsrr�starlette.requestsr �starlette.responsesr r �starlette.typesr r rr�starlette.websocketsrrrIr'r%�<module>rRs ��"�"�"�"�"�"� � � � ����������� C�B�B�B�B�B�B�B�&�&�&�&�&�&�;�;�;�;�;�;�;�;�9�9�9�9�9�9�9�9�9�9�9�9�*�*�*�*�*�*�7@�7@�7@�7@�7@�7@�7@�7@�7@�7@r'
Memory