mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added exception if destiny is turned off and key destiny is not default
This commit is contained in:
parent
bccf01320c
commit
42efa1f1af
1 changed files with 10 additions and 1 deletions
|
|
@ -12,7 +12,7 @@ except ModuleNotFoundError as e:
|
|||
|
||||
from aiogram import Bot
|
||||
from aiogram.dispatcher.fsm.state import State
|
||||
from aiogram.dispatcher.fsm.storage.base import BaseStorage, StateType, StorageKey
|
||||
from aiogram.dispatcher.fsm.storage.base import BaseStorage, StateType, StorageKey, DEFAULT_DESTINY
|
||||
|
||||
STATE = 'aiogram_state'
|
||||
DATA = 'aiogram_data'
|
||||
|
|
@ -75,6 +75,15 @@ class MongoStorage(BaseStorage):
|
|||
|
||||
if self._with_destiny:
|
||||
db_filter['destiny'] = key.destiny
|
||||
|
||||
elif key.destiny != DEFAULT_DESTINY:
|
||||
raise ValueError(
|
||||
"Mongo storage is not configured to use key destiny other the default.\n"
|
||||
"\n"
|
||||
"Probably, you should set `with_destiny=True` in for MongoStorage.\n"
|
||||
"E.g: `MongoStorage(mongo_client, ..., with_destiny=True)`"
|
||||
)
|
||||
|
||||
return db_filter
|
||||
|
||||
async def close(self) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue