Download python/user_packages/Python313/site-packages/chromadb/errors.py from codekingpro/portable-devtools: direct link, hf CLI and curl.
- Browser
- Download file 4.21 kB
-
https://huggingface.co/datasets/codekingpro/portable-devtools/resolve/df58e70f9edde36aaca2d2aacc2440dd6c2f807d/python/user_packages/Python313/site-packages/chromadb/errors.py
- Command line
-
hf download hf://datasets/codekingpro/portable-devtools@df58e70f9edde36aaca2d2aacc2440dd6c2f807d/python/user_packages/Python313/site-packages/chromadb/errors.py
-
curl -L -o errors.py https://huggingface.co/datasets/codekingpro/portable-devtools/resolve/df58e70f9edde36aaca2d2aacc2440dd6c2f807d/python/user_packages/Python313/site-packages/chromadb/errors.py
4.21 kB
| from abc import abstractmethod | |
| from typing import Dict, Optional, Type | |
| from overrides import overrides, EnforceOverrides | |
| class ChromaError(Exception, EnforceOverrides): | |
| trace_id: Optional[str] = None | |
| def code(self) -> int: | |
| """Return an appropriate HTTP response code for this error""" | |
| return 400 # Bad Request | |
| def message(self) -> str: | |
| return ", ".join(self.args) | |
| def name(cls) -> str: | |
| """Return the error name""" | |
| pass | |
| class InvalidDimensionException(ChromaError): | |
| def name(cls) -> str: | |
| return "InvalidDimension" | |
| class IDAlreadyExistsError(ChromaError): | |
| def code(self) -> int: | |
| return 409 # Conflict | |
| def name(cls) -> str: | |
| return "IDAlreadyExists" | |
| class ChromaAuthError(ChromaError): | |
| def code(self) -> int: | |
| return 403 | |
| def name(cls) -> str: | |
| return "AuthError" | |
| def message(self) -> str: | |
| return "Forbidden" | |
| class DuplicateIDError(ChromaError): | |
| def name(cls) -> str: | |
| return "DuplicateID" | |
| class InvalidArgumentError(ChromaError): | |
| def code(self) -> int: | |
| return 400 | |
| def name(cls) -> str: | |
| return "InvalidArgument" | |
| class InvalidUUIDError(ChromaError): | |
| def name(cls) -> str: | |
| return "InvalidUUID" | |
| class InvalidHTTPVersion(ChromaError): | |
| def name(cls) -> str: | |
| return "InvalidHTTPVersion" | |
| class AuthorizationError(ChromaError): | |
| def code(self) -> int: | |
| return 401 | |
| def name(cls) -> str: | |
| return "AuthorizationError" | |
| class NotFoundError(ChromaError): | |
| def code(self) -> int: | |
| return 404 | |
| def name(cls) -> str: | |
| return "NotFoundError" | |
| class UniqueConstraintError(ChromaError): | |
| def code(self) -> int: | |
| return 409 | |
| def name(cls) -> str: | |
| return "UniqueConstraintError" | |
| class BatchSizeExceededError(ChromaError): | |
| def code(self) -> int: | |
| return 413 | |
| def name(cls) -> str: | |
| return "BatchSizeExceededError" | |
| class VersionMismatchError(ChromaError): | |
| def code(self) -> int: | |
| return 500 | |
| def name(cls) -> str: | |
| return "VersionMismatchError" | |
| class InternalError(ChromaError): | |
| def code(self) -> int: | |
| return 500 | |
| def name(cls) -> str: | |
| return "InternalError" | |
| class RateLimitError(ChromaError): | |
| def code(self) -> int: | |
| return 429 | |
| def name(cls) -> str: | |
| return "RateLimitError" | |
| class QuotaError(ChromaError): | |
| def code(self) -> int: | |
| return 400 | |
| def name(cls) -> str: | |
| return "QuotaError" | |
| error_types: Dict[str, Type[ChromaError]] = { | |
| "InvalidDimension": InvalidDimensionException, | |
| "InvalidArgumentError": InvalidArgumentError, | |
| "IDAlreadyExists": IDAlreadyExistsError, | |
| "DuplicateID": DuplicateIDError, | |
| "InvalidUUID": InvalidUUIDError, | |
| "InvalidHTTPVersion": InvalidHTTPVersion, | |
| "AuthorizationError": AuthorizationError, | |
| "NotFoundError": NotFoundError, | |
| "BatchSizeExceededError": BatchSizeExceededError, | |
| "VersionMismatchError": VersionMismatchError, | |
| "RateLimitError": RateLimitError, | |
| "AuthError": ChromaAuthError, | |
| "UniqueConstraintError": UniqueConstraintError, | |
| "QuotaError": QuotaError, | |
| "InternalError": InternalError, | |
| # Catch-all for any other errors | |
| "ChromaError": ChromaError, | |
| } | |