frontends: async failures are more detailed (full class name + error message)
This commit is contained in:
parent
b9106c65d6
commit
a5dd35ce65
6 changed files with 18 additions and 20 deletions
|
|
@ -41,7 +41,7 @@ class Disco(base.CommandBase):
|
|||
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):
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
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):
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class EditBar(sat_widgets.ModalEdit):
|
|||
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 @@ class PrimitivusApp(QuickApp, InputHistory):
|
|||
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 @@ class PrimitivusApp(QuickApp, InputHistory):
|
|||
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):
|
||||
|
|
|
|||
|
|
@ -83,14 +83,12 @@ class ProfileManager(urwid.WidgetWrap):
|
|||
|
||||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ class QuickApp(object):
|
|||
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):
|
||||
|
|
|
|||
|
|
@ -256,8 +256,8 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
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 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue