
    g
                        S SK Jr  S SKrS SKJrJrJr  S SKJrJ	r	  S SK
Jr  S SKJrJr  S SKJrJrJrJr  S SKJr   " S	 S
5      rg)    )annotationsN)ExceptionHandlersStatusHandlerswrap_app_handling_exceptions)HTTPExceptionWebSocketException)Request)PlainTextResponseResponse)ASGIAppReceiveScopeSend)	WebSocketc                  h    \ rS rSr  S	       S
S jjr      SS jrSS jrSS jrSS jrSr	g)ExceptionMiddleware   Nc                    Xl         X0l        0 U l        [        U R                  [
        U R                  0U l        Ub+  UR                  5        H  u  pEU R                  XE5        M     g g N)
appdebug_status_handlersr   http_exceptionr   websocket_exception_exception_handlersitemsadd_exception_handler)selfr   handlersr   keyvalues         X/home/matz/Project1/venv/lib/python3.13/site-packages/starlette/middleware/exceptions.py__init__ExceptionMiddleware.__init__   sd     
024.. 8 87
  &nn.
**36 /      c                    [        U[        5      (       a  X R                  U'   g [        U[        5      (       d   eX R
                  U'   g r   )
isinstanceintr   
issubclass	Exceptionr   )r   exc_class_or_status_codehandlers      r"   r   )ExceptionMiddleware.add_exception_handler#   sD    
 .44>E!!":;6	BBBBAH$$%=>r%   c                   #    US   S;  a  U R                  XU5      I S h  vN   g U R                  U R                  4US'   US   S:X  a  [        XU5      nO[	        XU5      n[        U R                   U5      " XU5      I S h  vN   g  Nh N7f)Ntype)http	websocketzstarlette.exception_handlersr0   )r   r   r   r	   r   r   )r   scopereceivesendconns        r"   __call__ExceptionMiddleware.__call__.   s     = 55((54000 $$!!1
,- =F"540DUT2D*488T:54PPP 1 	Qs"   BB
A"BBBBc                    [        U[        5      (       d   eUR                  S;   a  [        UR                  UR                  S9$ [        UR                  UR                  UR                  S9$ )N>   0     )status_codeheaders)r'   r   r;   r   r<   r
   detail)r   requestexcs      r"   r   "ExceptionMiddleware.http_exception@   sT    #}----??j(MM RUR]R]^^r%   c                   #    [        U[        5      (       d   eUR                  UR                  UR                  S9I S h  vN   g  N7f)N)codereason)r'   r   closerB   rC   )r   r1   r?   s      r"   r   'ExceptionMiddleware.websocket_exceptionF   s7     #12222oo388CJJo???s   ?A	AA	)r   r   r   r   )NF)r   r   r   zRtyping.Mapping[typing.Any, typing.Callable[[Request, Exception], Response]] | Noner   boolreturnNone)r+   zint | type[Exception]r,   z/typing.Callable[[Request, Exception], Response]rG   rH   )r2   r   r3   r   r4   r   rG   rH   )r>   r	   r?   r*   rG   r   )r1   r   r?   r*   rG   rH   )
__name__
__module____qualname____firstlineno__r#   r   r6   r   r   __static_attributes__ r%   r"   r   r      sp     hl	77 e7 	7
 
7"	I"7	I A	I 
		IQ$_@r%   r   )
__future__r   typingstarlette._exception_handlerr   r   r   starlette.exceptionsr   r   starlette.requestsr	   starlette.responsesr
   r   starlette.typesr   r   r   r   starlette.websocketsr   r   rN   r%   r"   <module>rW      s6    "  
 C & ; 9 9 *7@ 7@r%   