Skip to content
Snippets Groups Projects
Commit ea493de2 authored by inso's avatar inso
Browse files

Catching more requests exceptions

parent 987a1a3f
No related branches found
No related tags found
No related merge requests found
......@@ -90,9 +90,9 @@ class Application(object):
wallet_path = os.path.join(config.parameters['home'],
account.name, '__cache__', wallet.pubkey)
if os.path.exists(wallet_path):
json_data = open(wallet_path, 'r')
data = json.load(json_data)
wallet.load_caches(data)
with open(wallet_path, 'r') as json_data:
data = json.load(json_data)
wallet.load_caches(data)
for community in account.communities:
wallet.refresh_cache(community)
......
......@@ -35,7 +35,12 @@ class Loader(QObject):
@pyqtSlot()
def load(self):
if self.account_name != "":
self.app.change_current_account(self.app.get_account(self.account_name))
try:
self.app.change_current_account(self.app.get_account(self.account_name))
except requests.exceptions.RequestException as e:
QMessageBox.critical(self, ":(",
str(e),
QMessageBox.Ok)
self.loaded.emit()
......@@ -163,7 +168,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
else:
for dead in self.app.current_account.dead_communities:
QMessageBox.critical(self, ":(",
"No {0} peers could be joined. Community was lost.".format(dead),
"No {0} peers could be joined. Connection to its network is lost.".format(dead),
QMessageBox.Ok)
self.action_set_as_default.setEnabled(self.app.current_account.name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment