proto.xmr.tw.view.action.a_sync_wallets: handle SocketError

This commit is contained in:
The MMGen Project 2025-11-29 09:12:42 +00:00
commit efb66dec9f
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2

View file

@ -83,10 +83,19 @@ class MoneroTwView:
class action(TwView.action):
async def a_sync_wallets(self, parent):
from ....util import msg, msg_r
from ....util import msg, msg_r, ymsg
from ....tw.view import CUR_HOME, ERASE_ALL
msg('')
op = xmrwallet_op('sync', parent.cfg, None, None, compat_call=True)
try:
op = xmrwallet_op('sync', parent.cfg, None, None, compat_call=True)
except Exception as e:
if type(e).__name__ == 'SocketError':
import asyncio
ymsg(str(e))
await asyncio.sleep(2)
msg_r(CUR_HOME + ERASE_ALL)
return False
raise
await op.restart_wallet_daemon()
await op.main()
await parent.get_data()