Spaces:
Sleeping
Sleeping
Download common/exceptions.py from valenynl/ReceiptSplitAI: direct link, hf CLI and curl.
- Browser
- Download file 619 Bytes
-
https://huggingface.co/spaces/valenynl/ReceiptSplitAI/resolve/main/common/exceptions.py
- Command line
-
hf download hf://spaces/valenynl/ReceiptSplitAI/common/exceptions.py
-
curl -L -o exceptions.py https://huggingface.co/spaces/valenynl/ReceiptSplitAI/resolve/main/common/exceptions.py
619 Bytes
| from api_exception.exception import APIException | |
| from common.enum.ai_service_error import AiServiceError | |
| class Conflict(APIException): | |
| status_code = 409 | |
| default_detail = "Conflict" | |
| default_code = "conflict" | |
| class AiServiceException(APIException): | |
| status_code = 400 | |
| def __init__(self, ai_error_code: AiServiceError, detail=None, status_code=None): | |
| self.error_code = ai_error_code.value | |
| self.detail = detail if detail is not None else ai_error_code.value | |
| if status_code is not None: | |
| self.status_code = status_code | |
| super().__init__(detail=self.detail) | |