frontends: async failures are more detailed (full class name + error message)
This commit is contained in:
parent
b9106c65d6
commit
a5dd35ce65
8 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()
|
||||
|
|
|
|||
|
|
@ -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 @@ class SAT(service.Service):
|
|||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class ProfileManager(object):
|
|||
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue