summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbendikro <bendikro@gmail.com>2013-02-16 17:56:05 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2013-05-10 16:30:35 +0100
commitbf77f42674326656c63d1fc13b6db631091955ec (patch)
tree757d20e8d7a683817ea5fbdac070e5ee423b5f48
parent7424cf2834f5d7ee3a3106d53897bb72d963bee3 (diff)
downloaddeluge-bf77f42674326.tar.gz
deluge-bf77f42674326.tar.bz2
deluge-bf77f42674326.zip
Fix #2217 - handling exceptions with authentication
-rw-r--r--deluge/ui/gtkui/preferences.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py
index d7fa3e200..36e0b58da 100644
--- a/deluge/ui/gtkui/preferences.py
+++ b/deluge/ui/gtkui/preferences.py
@@ -47,6 +47,7 @@ import common
import dialogs
from deluge.configmanager import ConfigManager
import deluge.configmanager
+from deluge.error import AuthManagerError, NotAuthorizedError
log = logging.getLogger(__name__)
@@ -1108,13 +1109,13 @@ class Preferences(component.Component):
self._on_get_known_accounts(accounts)
def on_fail(failure):
- if failure.value.exception_type == 'NotAuthorizedError':
+ if failure.type == NotAuthorizedError:
self.accounts_frame.hide()
else:
dialogs.ErrorDialog(
_("Server Side Error"),
_("An error ocurred on the server"),
- self.pref_dialog, details=failure.value.logable()
+ parent=self.pref_dialog, details=failure.getErrorMessage()
).run()
client.core.get_known_accounts().addCallback(on_ok).addErrback(on_fail)
@@ -1180,16 +1181,17 @@ class Preferences(component.Component):
)
def add_fail(failure):
- if failure.value.exception_type == 'AuthManagerError':
+ if failure.type == AuthManagerError:
dialogs.ErrorDialog(
_("Error Adding Account"),
- failure.value.exception_msg
+ _("Authentication failed"),
+ parent=self.pref_dialog, details=failure.getErrorMessage()
).run()
else:
dialogs.ErrorDialog(
_("Error Adding Account"),
_("An error ocurred while adding account"),
- self.pref_dialog, details=failure.value.logable()
+ parent=self.pref_dialog, details=failure.getErrorMessage()
).run()
if response_id == gtk.RESPONSE_OK:
@@ -1222,7 +1224,7 @@ class Preferences(component.Component):
dialogs.ErrorDialog(
_("Error Updating Account"),
_("An error ocurred while updating account"),
- self.pref_dialog, details=failure.value.logable()
+ parent=self.pref_dialog, details=failure.getErrorMessage()
).run()
if response_id == gtk.RESPONSE_OK:
@@ -1250,16 +1252,17 @@ class Preferences(component.Component):
model.remove(itr)
def remove_fail(failure):
- if failure.value.exception_type == 'AuthManagerError':
+ if failure.type == AuthManagerError:
dialogs.ErrorDialog(
_("Error Removing Account"),
- failure.value.exception_msg
+ _("Auhentication failed"),
+ parent=self.pref_dialog, details=failure.getErrorMessage()
).run()
else:
dialogs.ErrorDialog(
_("Error Removing Account"),
_("An error ocurred while removing account"),
- self.pref_dialog, details=failure.value.logable()
+ parent=self.pref_dialog, details=failure.getErrorMessage()
).run()
if response_id == gtk.RESPONSE_YES:
client.core.remove_account(