print backtraces

This commit is contained in:
Christophe Benz 2010-05-14 00:44:27 +02:00
commit 477c298131
2 changed files with 22 additions and 24 deletions

View file

@ -2,23 +2,20 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai # vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
""" # Copyright(C) 2009-2010 Romain Bignon, Christophe Benz
Copyright(C) 2009-2010 Romain Bignon, Christophe Benz #
# This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3 of the License.
the Free Software Foundation, version 3 of the License. #
# This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details.
GNU General Public License for more details. #
# You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""
from __future__ import with_statement from __future__ import with_statement
@ -46,12 +43,12 @@ class Boobank(ConsoleApplication):
try: try:
for backend, account in self.weboob.do('iter_accounts'): for backend, account in self.weboob.do('iter_accounts'):
print self.format(account) print self.format(account)
except weboob.CallErrors, e: except weboob.CallErrors, errors:
for backend, error in e.errors: for backend, error, backtrace in errors:
if isinstance(error, weboob.tools.browser.BrowserIncorrectPassword): if isinstance(error, weboob.tools.browser.BrowserIncorrectPassword):
logging.error(u'Error: Incorrect password for backend %s' % backend.name) logging.error(u'Error: Incorrect password for backend %s' % backend.name)
else: else:
logging.error(u'Error[%s]: %s' % (backend.name, error)) logging.error(u'Error[%s]: %s\n%s' % (backend.name, error, backtrace))
@ConsoleApplication.command('Display all future operations') @ConsoleApplication.command('Display all future operations')
def command_coming(self, id): def command_coming(self, id):
@ -65,9 +62,9 @@ class Boobank(ConsoleApplication):
for backend, operation in self.weboob.do(do): for backend, operation in self.weboob.do(do):
print self.format(operation) print self.format(operation)
total += operation.amount total += operation.amount
except weboob.CallErrors, e: except weboob.CallErrors, errors:
for backend, error in e.errors: for backend, error, backtrace in errors:
if isinstance(error, AccountNotFound): if isinstance(error, AccountNotFound):
logging.error(u'Error: account %s not found' % id) logging.error(u'Error: account %s not found' % id)
else: else:
logging.error(u'Error[%s]: %s' % (backend.name, error)) logging.error(u'Error[%s]: %s\n%s' % (backend.name, error, backtrace))

View file

@ -86,8 +86,9 @@ class MainWindow(QtMainWindow):
self.emit(SIGNAL('newData'), backend, video) self.emit(SIGNAL('newData'), backend, video)
def eb(backend, err): def eb(backend, err, backtrace):
print err print err
print backtrace
backend_name = str(self.ui.backendEdit.itemData(self.ui.backendEdit.currentIndex()).toString()) backend_name = str(self.ui.backendEdit.itemData(self.ui.backendEdit.currentIndex()).toString())
if backend_name: if backend_name: