Exceptions¶
Hierarchy¶
FastVKError (base)
├── VKAPIError
├── HandlerNotFoundError
├── FilterError
├── StorageError
└── PollingError
All exceptions inherit from FastVKError, which inherits from Exception.
FastVKError¶
Base class. Catch this to handle any FastVK error.
VKAPIError¶
from fastvk.exceptions import VKAPIError
class VKAPIError(FastVKError):
error_code: int
error_msg: str
request_params: list[dict]
Raised when the VK API returns {"error": {...}}.
Common codes:
| Code | Meaning |
|---|---|
| 5 | Invalid or expired token |
| 7 | Permission denied |
| 9 | Flood control limit reached |
| 100 | Invalid parameter value |
| 914 | Message text too long |
HandlerNotFoundError¶
Raised when no handler matches an incoming update. The bot silently skips these by default.
FilterError¶
Raised when a filter raises an unexpected exception during evaluation.
StorageError¶
Raised when FSM storage operations fail (connection error, serialization failure, etc.).
PollingError¶
Raised when the long-poll request itself fails (network error, invalid server response). The polling loop retries automatically with backoff.