1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-14 03:30:02 +00:00

feat(core): raise InvalidSessionError when active session is None in old codec when accessed from context

[no changelog]
This commit is contained in:
M1nd3r 2024-07-31 10:39:34 +02:00
parent c9e3ed2bb6
commit cae780b401

View File

@ -16,7 +16,7 @@ for ButtonRequests. Of course, `context.wait()` transparently works in such situ
from typing import TYPE_CHECKING
from storage import cache, cache_codec
from storage.cache_common import SESSIONLESS_FLAG
from storage.cache_common import SESSIONLESS_FLAG, InvalidSessionError
from trezor import log, loop, protobuf
from trezor.wire import codec_v1
@ -168,7 +168,7 @@ class CodecContext(Context):
def cache(self) -> DataCache:
c = cache_codec.get_active_session()
if c is None:
raise Exception("There is no active session")
raise InvalidSessionError()
return c