fix: normalize snapshot read failures to unavailable in slots RPC path
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
f394f1560d
commit
d4a968ee1a
@@ -49,6 +49,7 @@ class AccountSnapshotUnavailable(RuntimeError):
|
||||
"account_mismatch",
|
||||
"expired",
|
||||
"live_read_failed",
|
||||
"read_failed",
|
||||
})
|
||||
|
||||
def __init__(self, code: str) -> None:
|
||||
@@ -189,7 +190,15 @@ class AccountSnapshotService:
|
||||
account_hash = self._broker.account_scope_hash()
|
||||
if not account_hash:
|
||||
raise AccountSnapshotUnavailable("account_mismatch")
|
||||
snapshot = self._store.load(account_hash)
|
||||
try:
|
||||
snapshot = self._store.load(account_hash)
|
||||
except Exception as exc:
|
||||
_log.warning(
|
||||
"account snapshot load failed: account_hash=%s",
|
||||
account_hash,
|
||||
exc_info=True,
|
||||
)
|
||||
raise AccountSnapshotUnavailable("read_failed") from exc
|
||||
if snapshot is None or snapshot.account_hash != account_hash:
|
||||
raise AccountSnapshotUnavailable("account_mismatch")
|
||||
return snapshot
|
||||
|
||||
Reference in New Issue
Block a user