Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.d/130.removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**`fastapi_cachex.exceptions.CacheError` is removed.** Nothing in the package
ever raised it, and it had emitted a `DeprecationWarning` since 0.3.8. Catch
`CacheXError` instead.
4 changes: 0 additions & 4 deletions docs/api/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@
::: fastapi_cachex.types

::: fastapi_cachex.exceptions

`fastapi_cachex.exceptions.CacheError` is deprecated since 0.3.8 and not listed
above. Nothing in the package raises it, and accessing it emits a
`DeprecationWarning`. Catch `CacheXError` instead. It will be removed in 0.4.0.
32 changes: 0 additions & 32 deletions fastapi_cachex/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
"""Custom exception classes for FastAPI-CacheX."""

import warnings
from typing import TYPE_CHECKING


class CacheXError(Exception):
"""Base class for all exceptions in FastAPI-CacheX."""


class _CacheError(CacheXError):
"""Exception raised for cache-related errors.

.. deprecated:: 0.3.8
Never raised by FastAPI-CacheX. Catch :class:`CacheXError` instead.
Will be removed in version 0.4.0.
"""


_CacheError.__name__ = _CacheError.__qualname__ = "CacheError"

if TYPE_CHECKING:
CacheError = _CacheError


class BackendNotFoundError(CacheXError):
"""Exception raised when a cache backend is not found."""

Expand All @@ -42,17 +24,3 @@ class RequestNotFoundError(CacheXError):

class LockTimeoutError(CacheXError, TimeoutError):
"""Exception raised when acquiring a lock or waiting for stampede protection times out."""


def __getattr__(name: str) -> type[CacheXError]:
"""Return the deprecated ``CacheError`` with a ``DeprecationWarning``."""
if name == "CacheError":
warnings.warn(
"CacheError is deprecated and never raised, catch CacheXError instead. "
"Will be removed in version 0.4.0.",
DeprecationWarning,
stacklevel=2,
)
return _CacheError
msg = f"module {__name__!r} has no attribute {name!r}"
raise AttributeError(msg)
35 changes: 0 additions & 35 deletions tests/test_exceptions.py

This file was deleted.

Loading