display error if there is an internet connection problem during startup
This commit is contained in:
parent
942f9296a0
commit
4c220cbb36
@ -36,6 +36,7 @@
|
|||||||
* Authentication errors should be handled gracefully by the application:
|
* Authentication errors should be handled gracefully by the application:
|
||||||
* When there is a password change, Socializer must be reauthorized again. An error message will indicate this if the user forgot to do that. After the error, the app will be restarted, prompting the user to introduce the new data for authorizing the application.
|
* When there is a password change, Socializer must be reauthorized again. An error message will indicate this if the user forgot to do that. After the error, the app will be restarted, prompting the user to introduce the new data for authorizing the application.
|
||||||
* If the user introduced incorrect or invalid data, Socializer will display an error and prompt the user again for valid information.
|
* If the user introduced incorrect or invalid data, Socializer will display an error and prompt the user again for valid information.
|
||||||
|
* If there is a connection problem when opening Socializer, it will display an error and inform the user about the issue.
|
||||||
|
|
||||||
## Changes in version 0.18 (21.01.2019)
|
## Changes in version 0.18 (21.01.2019)
|
||||||
|
|
||||||
|
@ -286,6 +286,7 @@ class Controller(object):
|
|||||||
pub.subscribe(self.update_status_bar, "update-status-bar")
|
pub.subscribe(self.update_status_bar, "update-status-bar")
|
||||||
pub.subscribe(self.chat_from_id, "new-chat")
|
pub.subscribe(self.chat_from_id, "new-chat")
|
||||||
pub.subscribe(self.authorisation_failed, "authorisation-failed")
|
pub.subscribe(self.authorisation_failed, "authorisation-failed")
|
||||||
|
pub.subscribe(self.connection_error, "connection_error")
|
||||||
pub.subscribe(self.user_profile, "user-profile")
|
pub.subscribe(self.user_profile, "user-profile")
|
||||||
pub.subscribe(self.user_online, "user-online")
|
pub.subscribe(self.user_online, "user-online")
|
||||||
pub.subscribe(self.user_offline, "user-offline")
|
pub.subscribe(self.user_offline, "user-offline")
|
||||||
@ -391,6 +392,15 @@ class Controller(object):
|
|||||||
commonMessages.bad_authorisation()
|
commonMessages.bad_authorisation()
|
||||||
restart.restart_program()
|
restart.restart_program()
|
||||||
|
|
||||||
|
def connection_error(self, *args, **kwargs):
|
||||||
|
commonMessages.connection_error()
|
||||||
|
self.disconnect_events()
|
||||||
|
volume = player.player.volume
|
||||||
|
config.app["sound"]["volume"] = volume
|
||||||
|
config.app.write()
|
||||||
|
self.window.Destroy()
|
||||||
|
wx.GetApp().ExitMainLoop()
|
||||||
|
|
||||||
def user_profile(self, person):
|
def user_profile(self, person):
|
||||||
""" display someone's profile. For now, only users are supported."""
|
""" display someone's profile. For now, only users are supported."""
|
||||||
p = presenters.userProfilePresenter(session=self.session, user_id=person, view=views.userProfileDialog(), interactor=interactors.userProfileInteractor())
|
p = presenters.userProfilePresenter(session=self.session, user_id=person, view=views.userProfileDialog(), interactor=interactors.userProfileInteractor())
|
||||||
|
@ -8,6 +8,7 @@ import languageHandler
|
|||||||
import paths
|
import paths
|
||||||
import config
|
import config
|
||||||
import sound
|
import sound
|
||||||
|
from requests.exceptions import ProxyError, ConnectionError
|
||||||
from .config_utils import Configuration, ConfigurationResetException
|
from .config_utils import Configuration, ConfigurationResetException
|
||||||
from . import vkSessionHandler
|
from . import vkSessionHandler
|
||||||
from pubsub import pub
|
from pubsub import pub
|
||||||
@ -110,6 +111,8 @@ class vkSession(object):
|
|||||||
# log.exception("The session configuration has failed.")
|
# log.exception("The session configuration has failed.")
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
|
""" Logging in VK.com. This is basically the first method interacting with VK. """
|
||||||
|
# If user is already logged in, we should skip this method.
|
||||||
if self.logged == True:
|
if self.logged == True:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
@ -130,10 +133,12 @@ class vkSession(object):
|
|||||||
self.settings["vk"]["device_id"] = ""
|
self.settings["vk"]["device_id"] = ""
|
||||||
self.settings.write()
|
self.settings.write()
|
||||||
pub.sendMessage("authorisation-failed")
|
pub.sendMessage("authorisation-failed")
|
||||||
else: # print out error so we we will handle it.
|
else: # print out error so we we will handle it in future versions.
|
||||||
log.exception("Fatal error when authenticating the application.")
|
log.exception("Fatal error when authenticating the application.")
|
||||||
log.exception(error.code)
|
log.exception(error.code)
|
||||||
log.exception(error.message)
|
log.exception(error.message)
|
||||||
|
except (ProxyError, ConnectionError):
|
||||||
|
pub.sendMessage("connection_error")
|
||||||
|
|
||||||
def post_wall_status(self, message, *args, **kwargs):
|
def post_wall_status(self, message, *args, **kwargs):
|
||||||
""" Sends a post to an user, group or community wall."""
|
""" Sends a post to an user, group or community wall."""
|
||||||
|
Loading…
Reference in New Issue
Block a user