� K�gi��|�UddlmZmZmZmZmZmZddlmZm Z ddl m Z ddl m ZddlmZmZGd�de ��Z Gd�d e��Z e d ��Zeeed <e d ��Zeeed <Gd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZdS)�)�Any�Dict�Optional�Sequence�Type�Union)� BaseModel� create_model)� HTTPException)�WebSocketException)� Annotated�Docc ���eZdZdZ d deeed��fdeeed��fdeee e e fed��fd df�fd � Z �xZ S) r a� An HTTP exception you can raise in your own code to show errors to the client. This is for client errors, invalid authentication, invalid data, etc. Not for server errors in your code. Read more about it in the [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/). ## Example ```python from fastapi import FastAPI, HTTPException app = FastAPI() items = {"foo": "The Foo Wrestlers"} @app.get("/items/{item_id}") async def read_item(item_id: str): if item_id not in items: raise HTTPException(status_code=404, detail="Item not found") return {"item": items[item_id]} ``` N� status_codezI HTTP status code to send to the client. �detailz} Any data to be sent to the client in the `detail` key of the JSON response. �headerszT Any headers to send to the client in the response. �returnc�P��t���|||���dS)N)rrr��super�__init__)�selfrrr� __class__s ��b/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fastapi/exceptions.pyrzHTTPException.__init__%s*���8 �����[����Q�Q�Q�Q�Q�)NN) �__name__� __module__� __qualname__�__doc__r �intrrrr�strr� __classcell__�rs@rr r s����������Z � �5R�R�� � �C�� � � � �R�� � �C�� � � � �R�&� �T�#�s�(�^� $� �C�� � � � �'R�6 �7R�R�R�R�R�R�R�R�R�Rrr c ���eZdZdZ d deeed��fdeeedfed��fddf�fd� Z �xZ S) r a^ A WebSocket exception you can raise in your own code to show errors to the client. This is for client errors, invalid authentication, invalid data, etc. Not for server errors in your code. Read more about it in the [FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/). ## Example ```python from typing import Annotated from fastapi import ( Cookie, FastAPI, WebSocket, WebSocketException, status, ) app = FastAPI() @app.websocket("/items/{item_id}/ws") async def websocket_endpoint( *, websocket: WebSocket, session: Annotated[str | None, Cookie()] = None, item_id: str, ): if session is None: raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION) await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text(f"Session cookie is: {session}") await websocket.send_text(f"Message text was: {data}, for item ID: {item_id}") ``` N�codez� A closing code from the [valid codes defined in the specification](https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1). �reasonaw The reason to close the WebSocket connection. It is UTF-8-encoded data. The interpretation of the reason is up to the application, it is not specified by the WebSocket specification. It could contain text that could be human-readable or interpretable by the client code, etc. rc�N��t���||���dS)N)r%r&r)rr%r&rs �rrzWebSocketException.__init__ns(���4 �����d�6��2�2�2�2�2r�N) rrrrr r rrr!rr"r#s@rr r Ds��������'�'�B �13�3�� � �C�� � � � �3�� �#�t�)� � �C�� � � �  �3�2 �33�3�3�3�3�3�3�3�3�3rr �Request�RequestErrorModel� WebSocket�WebSocketErrorModelc��eZdZdZdS)� FastAPIErrorz, A generic, FastAPI-specific error. N)rrrr�rrr.r.�s���������rr.c�B�eZdZdeeddfd�Zdeefd�ZdS)�ValidationException�errorsrNc��||_dSr(��_errors)rr2s rrzValidationException.__init__�s ���� � � rc��|jSr(r4)rs rr2zValidationException.errors�s ���|�r)rrrrrrr2r/rrr1r1�sY�������x��}���������� ������rr1c�>��eZdZdd�deededdf�fd�Z�xZS)�RequestValidationErrorN��bodyr2r:rc�X��t���|��||_dSr(�rrr:�rr2r:rs �rrzRequestValidationError.__init__��&��� ������ � � ��� � � r)rrrrrrr"r#s@rr8r8�sc�������=A����x��}��s��d����������rr8c��eZdZdS)�WebSocketRequestValidationErrorN)rrrr/rrr@r@�s�������Drr@c�J��eZdZdd�deededdf�fd�Zdefd�Z�xZS)�ResponseValidationErrorNr9r2r:rc�X��t���|��||_dSr(r<r=s �rrz ResponseValidationError.__init__�r>rc�Z�t|j���d�}|jD] }|d|�d�z }� |S)Nz validation errors: z � )�lenr5)r�message�errs r�__str__zResponseValidationError.__str__�sD�����&�&�=�=�=���<� $� $�C� �|�C�|�|�|� #�G�G��r) rrrrrrr!rIr"r#s@rrBrB�s~�������=A����x��}��s��d����������������rrBN)�typingrrrrrr�pydanticr r �starlette.exceptionsr �StarletteHTTPExceptionr �StarletteWebSocketException�typing_extensionsr rr*�__annotations__r,� RuntimeErrorr.� Exceptionr1r8r@rBr/rr�<module>rSs��=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�,�,�,�,�,�,�,�,�H�H�H�H�H�H�R�R�R�R�R�R�,�,�,�,�,�,�,�,�8R�8R�8R�8R�8R�*�8R�8R�8R�vD3�D3�D3�D3�D3�4�D3�D3�D3�N&2�\�)�%<�%<��4� �?�<�<�<�'3�|�K�'@�'@��T�)�_�@�@�@������<���� �����)���������0����  � � � � �&9� � � � � � � � �1� � � � � r
Memory