verbose error messages in Qt applications (closes #775)
This commit is contained in:
parent
a94d6c9972
commit
dfb52a2624
4 changed files with 18 additions and 8 deletions
|
|
@ -172,11 +172,11 @@ class RadioFranceBackend(BaseBackend, ICapRadio, ICapCollection, ICapVideo):
|
||||||
radio.current.artist = artist
|
radio.current.artist = artist
|
||||||
return radio
|
return radio
|
||||||
|
|
||||||
# avoid warning, but TODO
|
# TODO
|
||||||
# http://www.franceculture.fr/recherche/key%3DYOURSEARCH%2526type%3Demission
|
# http://www.franceculture.fr/recherche/key%3DYOURSEARCH%2526type%3Demission
|
||||||
# http://www.franceinter.fr/recherche/key%3DYOURSEARCH%2526tri%3Dpertinence%2526theme%3Ddefault%2526type%3Demission
|
# http://www.franceinter.fr/recherche/key%3DYOURSEARCH%2526tri%3Dpertinence%2526theme%3Ddefault%2526type%3Demission
|
||||||
def iter_search_results(self, *args, **kwargs):
|
#def iter_search_results(self, *args, **kwargs):
|
||||||
return []
|
# return []
|
||||||
|
|
||||||
def get_video(self, _id):
|
def get_video(self, _id):
|
||||||
with self.browser:
|
with self.browser:
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ from weboob.tools.browser.decorators import id2url
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from time import time
|
from time import time
|
||||||
import re
|
import re
|
||||||
import urlparse
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
|
|
|
||||||
|
|
@ -446,6 +446,7 @@ class ConsoleApplication(BaseApplication):
|
||||||
msg = unicode(error)
|
msg = unicode(error)
|
||||||
if not msg:
|
if not msg:
|
||||||
msg = 'invalid login/password.'
|
msg = 'invalid login/password.'
|
||||||
|
# TODO ask to reconfigure backend
|
||||||
print >>sys.stderr, 'Error(%s): %s' % (backend.name, msg)
|
print >>sys.stderr, 'Error(%s): %s' % (backend.name, msg)
|
||||||
if self.ask('Do you want to reconfigure this backend?', default=True):
|
if self.ask('Do you want to reconfigure this backend?', default=True):
|
||||||
self.unload_backends(names=[backend.name])
|
self.unload_backends(names=[backend.name])
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ from PyQt4.QtGui import QMainWindow, QApplication, QStyledItemDelegate, \
|
||||||
|
|
||||||
from weboob.core.ouiboube import Weboob
|
from weboob.core.ouiboube import Weboob
|
||||||
from weboob.core.scheduler import IScheduler
|
from weboob.core.scheduler import IScheduler
|
||||||
|
from weboob.tools.browser import BrowserUnavailable, BrowserIncorrectPassword
|
||||||
from weboob.tools.value import ValueInt, ValueBool, ValueBackendPassword
|
from weboob.tools.value import ValueInt, ValueBool, ValueBackendPassword
|
||||||
|
|
||||||
from ..base import BaseApplication
|
from ..base import BaseApplication
|
||||||
|
|
@ -164,9 +165,17 @@ class QtDo(QObject):
|
||||||
self.process.callback_thread(self.thread_cb, self.thread_eb)
|
self.process.callback_thread(self.thread_cb, self.thread_eb)
|
||||||
|
|
||||||
def default_eb(self, backend, error, backtrace):
|
def default_eb(self, backend, error, backtrace):
|
||||||
# TODO display a messagebox
|
msg = unicode(error)
|
||||||
msg = u'%s' % error
|
if isinstance(error, BrowserIncorrectPassword):
|
||||||
if logging.root.level == logging.DEBUG:
|
if not msg:
|
||||||
|
msg = 'Invalid login/password.'
|
||||||
|
elif isinstance(error, BrowserUnavailable):
|
||||||
|
if not msg:
|
||||||
|
msg = 'website is unavailable.'
|
||||||
|
elif isinstance(error, NotImplementedError):
|
||||||
|
msg = 'This feature is not supported by this backend.\n\n' \
|
||||||
|
'To help the maintainer of this backend implement this feature, please contact: %s <%s>' % (backend.MAINTAINER, backend.EMAIL)
|
||||||
|
elif logging.root.level == logging.DEBUG:
|
||||||
msg += '<br />'
|
msg += '<br />'
|
||||||
ul_opened = False
|
ul_opened = False
|
||||||
for line in backtrace.split('\n'):
|
for line in backtrace.split('\n'):
|
||||||
|
|
@ -184,7 +193,8 @@ class QtDo(QObject):
|
||||||
msg += '</li></ul>'
|
msg += '</li></ul>'
|
||||||
print >>sys.stderr, error
|
print >>sys.stderr, error
|
||||||
print >>sys.stderr, backtrace
|
print >>sys.stderr, backtrace
|
||||||
QMessageBox.critical(None, self.tr('Error'), msg, QMessageBox.Ok)
|
QMessageBox.critical(None, unicode(self.tr('Error with backend %s')) % backend.name,
|
||||||
|
msg, QMessageBox.Ok)
|
||||||
|
|
||||||
def local_cb(self, backend, data):
|
def local_cb(self, backend, data):
|
||||||
self.cb(backend, data)
|
self.cb(backend, data)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue