mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-13 11:48:40 +00:00
Fix #2217 - handling exceptions with authentication
This commit is contained in:
parent
7424cf2834
commit
bf77f42674
1 changed files with 12 additions and 9 deletions
|
@ -47,6 +47,7 @@ import common
|
||||||
import dialogs
|
import dialogs
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
import deluge.configmanager
|
import deluge.configmanager
|
||||||
|
from deluge.error import AuthManagerError, NotAuthorizedError
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -1108,13 +1109,13 @@ class Preferences(component.Component):
|
||||||
self._on_get_known_accounts(accounts)
|
self._on_get_known_accounts(accounts)
|
||||||
|
|
||||||
def on_fail(failure):
|
def on_fail(failure):
|
||||||
if failure.value.exception_type == 'NotAuthorizedError':
|
if failure.type == NotAuthorizedError:
|
||||||
self.accounts_frame.hide()
|
self.accounts_frame.hide()
|
||||||
else:
|
else:
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_("Server Side Error"),
|
_("Server Side Error"),
|
||||||
_("An error ocurred on the server"),
|
_("An error ocurred on the server"),
|
||||||
self.pref_dialog, details=failure.value.logable()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
).run()
|
).run()
|
||||||
client.core.get_known_accounts().addCallback(on_ok).addErrback(on_fail)
|
client.core.get_known_accounts().addCallback(on_ok).addErrback(on_fail)
|
||||||
|
|
||||||
|
@ -1180,16 +1181,17 @@ class Preferences(component.Component):
|
||||||
)
|
)
|
||||||
|
|
||||||
def add_fail(failure):
|
def add_fail(failure):
|
||||||
if failure.value.exception_type == 'AuthManagerError':
|
if failure.type == AuthManagerError:
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_("Error Adding Account"),
|
_("Error Adding Account"),
|
||||||
failure.value.exception_msg
|
_("Authentication failed"),
|
||||||
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
).run()
|
).run()
|
||||||
else:
|
else:
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_("Error Adding Account"),
|
_("Error Adding Account"),
|
||||||
_("An error ocurred while adding account"),
|
_("An error ocurred while adding account"),
|
||||||
self.pref_dialog, details=failure.value.logable()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
).run()
|
).run()
|
||||||
|
|
||||||
if response_id == gtk.RESPONSE_OK:
|
if response_id == gtk.RESPONSE_OK:
|
||||||
|
@ -1222,7 +1224,7 @@ class Preferences(component.Component):
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_("Error Updating Account"),
|
_("Error Updating Account"),
|
||||||
_("An error ocurred while updating account"),
|
_("An error ocurred while updating account"),
|
||||||
self.pref_dialog, details=failure.value.logable()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
).run()
|
).run()
|
||||||
|
|
||||||
if response_id == gtk.RESPONSE_OK:
|
if response_id == gtk.RESPONSE_OK:
|
||||||
|
@ -1250,16 +1252,17 @@ class Preferences(component.Component):
|
||||||
model.remove(itr)
|
model.remove(itr)
|
||||||
|
|
||||||
def remove_fail(failure):
|
def remove_fail(failure):
|
||||||
if failure.value.exception_type == 'AuthManagerError':
|
if failure.type == AuthManagerError:
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_("Error Removing Account"),
|
_("Error Removing Account"),
|
||||||
failure.value.exception_msg
|
_("Auhentication failed"),
|
||||||
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
).run()
|
).run()
|
||||||
else:
|
else:
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_("Error Removing Account"),
|
_("Error Removing Account"),
|
||||||
_("An error ocurred while removing account"),
|
_("An error ocurred while removing account"),
|
||||||
self.pref_dialog, details=failure.value.logable()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
).run()
|
).run()
|
||||||
if response_id == gtk.RESPONSE_YES:
|
if response_id == gtk.RESPONSE_YES:
|
||||||
client.core.remove_account(
|
client.core.remove_account(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue