Mercurial > libervia-backend
changeset 1063:6ec513ad92c2
frontends: async failures are more detailed (full class name + error message)
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 07 Jun 2014 15:39:20 +0200 |
parents | 95758ef3faa8 |
children | 7ee9d9db67b9 |
files | frontends/src/jp/cmd_info.py frontends/src/primitivus/chat.py frontends/src/primitivus/primitivus frontends/src/primitivus/profile_manager.py frontends/src/quick_frontend/quick_app.py frontends/src/wix/main_window.py src/core/sat_main.py src/stdui/ui_profile_manager.py |
diffstat | 8 files changed, 18 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/jp/cmd_info.py Sat Jun 07 15:20:39 2014 +0200 +++ b/frontends/src/jp/cmd_info.py Sat Jun 07 15:39:20 2014 +0200 @@ -41,7 +41,7 @@ self.host.bridge.discoInfos(jid, profile_key=self.host.profile, callback=lambda infos: self.gotInfos(infos, jid), errback=self.error) def error(self, failure): - print (_("Error while doing discovery")) + print (_("Error while doing discovery [%s]") % failure) self.host.quit(1) def gotInfos(self, infos, jid):
--- a/frontends/src/primitivus/chat.py Sat Jun 07 15:20:39 2014 +0200 +++ b/frontends/src/primitivus/chat.py Sat Jun 07 15:39:20 2014 +0200 @@ -354,7 +354,7 @@ def gotUI(xmlui): self.host.addWindow(XMLUI(self.host, xmlui)) def configureError(failure): - self.host.showPopUp(sat_widgets.Alert(_("Error"), unicode(failure), ok_cb=self.host.removePopUp)) + self.host.showPopUp(sat_widgets.Alert(failure.fullname, failure.message, ok_cb=self.host.removePopUp)) self.host.bridge.configureRoom(self.id, self.host.profile, callback=gotUI, errback=configureError) def onSendFileRequest(self, menu):
--- a/frontends/src/primitivus/primitivus Sat Jun 07 15:20:39 2014 +0200 +++ b/frontends/src/primitivus/primitivus Sat Jun 07 15:39:20 2014 +0200 @@ -102,7 +102,7 @@ self.app.sendMessage(contact, editBar.get_edit_text(), mess_type = "groupchat" if chat.type == 'group' else "chat", - errback=lambda failure: self.app.notify(_("Error while sending message (%s)") % unicode(failure)), + errback=lambda failure: self.app.notify(_("Error while sending message (%s)") % failure), profile_key=self.app.profile ) editBar.set_edit_text('') @@ -468,7 +468,7 @@ self.showPopUp(sat_widgets.Alert(_("Error"), _(u"Unmanaged action result"), ok_cb=self.removePopUp)) def action_eb(failure): - self.showPopUp(sat_widgets.Alert(_("Error"), unicode(failure), ok_cb=self.removePopUp)) + self.showPopUp(sat_widgets.Alert(failure.fullname, failure.message, ok_cb=self.removePopUp)) self.bridge.launchAction(callback_id, data, profile_key, callback=action_cb, errback=action_eb) @@ -571,7 +571,7 @@ self.addWindow(XMLUI(self, xml_data=params)) def failure(error): - self.showPopUp(sat_widgets.Alert(_("Error"), _("Can't get parameters"), ok_cb=self.removePopUp)) + self.showPopUp(sat_widgets.Alert(_("Error"), _("Can't get parameters (%s)") % error, ok_cb=self.removePopUp)) self.bridge.getParamsUI(app=C.APP_NAME, profile_key=self.profile, callback=success, errback=failure) def onExitRequest(self, menu):
--- a/frontends/src/primitivus/profile_manager.py Sat Jun 07 15:20:39 2014 +0200 +++ b/frontends/src/primitivus/profile_manager.py Sat Jun 07 15:39:20 2014 +0200 @@ -83,14 +83,12 @@ def _profileCreationFailure(self, reason): self.host.removePopUp() - if reason=="ConflictError": - message=_("A profile with this name already exists") - elif reason=="CancelError": - message=_("Profile creation cancelled by backend") - elif reason=="DATABASE": # FIXME: doesn't seem to exist ! - message=_("Database error") + if reason == "ConflictError": + message = _("A profile with this name already exists") + elif reason == "CancelError": + message = _("Profile creation cancelled by backend") else: - message=_("Unknown reason (%s)") % reason + message = _("Unknown reason (%s)") % reason popup = Alert(_("Can't create profile"), message, ok_cb=self.host.removePopUp) self.host.showPopUp(popup)
--- a/frontends/src/quick_frontend/quick_app.py Sat Jun 07 15:20:39 2014 +0200 +++ b/frontends/src/quick_frontend/quick_app.py Sat Jun 07 15:39:20 2014 +0200 @@ -287,7 +287,7 @@ if callback is None: callback = lambda: None if errback is None: - errback = lambda failure: self.showDialog(unicode(failure), _(u"sendMessage Error"), "error") + errback = lambda failure: self.showDialog(failure.fullname, failure.message, "error") self.bridge.sendMessage(to_jid, message, subject, mess_type, extra, profile_key, callback=callback, errback=errback) def newAlert(self, msg, title, alert_type, profile):
--- a/frontends/src/wix/main_window.py Sat Jun 07 15:20:39 2014 +0200 +++ b/frontends/src/wix/main_window.py Sat Jun 07 15:39:20 2014 +0200 @@ -256,8 +256,8 @@ dlg.ShowModal() dlg.Destroy() def action_eb(failure): - dlg = wx.MessageDialog(self, unicode(failure), - _('Error'), + dlg = wx.MessageDialog(self, failure.message, + failure.fullname, wx.OK | wx.ICON_ERROR ) dlg.ShowModal() @@ -411,8 +411,8 @@ XMLUI(self, xml_data=params, title=_("Configuration")) def failure(error): - dlg = wx.MessageDialog(self, unicode(error), - _('Error'), + dlg = wx.MessageDialog(self, error.message, + error.fullname, wx.OK | wx.ICON_ERROR ) dlg.ShowModal()
--- a/src/core/sat_main.py Sat Jun 07 15:20:39 2014 +0200 +++ b/src/core/sat_main.py Sat Jun 07 15:39:20 2014 +0200 @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from sat.core.i18n import _, languageSwitch +from sat.core.i18n import _, D_, languageSwitch from twisted.application import service from twisted.internet import defer from twisted.words.protocols.jabber import jid @@ -298,7 +298,7 @@ def check_result(result): if not result: log.warning(_('Authentication failure of profile %s') % profile) - raise exceptions.PasswordError(_("The provided profile password doesn't match.")) + raise exceptions.PasswordError(D_("The provided profile password doesn't match.")) if not session_data: # avoid to create two profile sessions when password if specified return self.memory.newAuthSession(password, profile)
--- a/src/stdui/ui_profile_manager.py Sat Jun 07 15:20:39 2014 +0200 +++ b/src/stdui/ui_profile_manager.py Sat Jun 07 15:39:20 2014 +0200 @@ -80,7 +80,7 @@ def getParamError(self): _dialog = xml_tools.XMLUI('popup', title=D_('Error')) - _dialog.addText(_("Can't get profile parameter.")) + _dialog.addText(D_("Can't get profile parameter.")) return {'xmlui': _dialog.toXml()} @defer.inlineCallbacks