print call errors
This commit is contained in:
parent
d99822d848
commit
711f2c73a3
2 changed files with 20 additions and 5 deletions
|
|
@ -28,7 +28,7 @@ import sys
|
||||||
import logging
|
import logging
|
||||||
import asyncore
|
import asyncore
|
||||||
|
|
||||||
from weboob.core.ouiboube import Weboob
|
from weboob.core import Weboob, CallErrors
|
||||||
from weboob.core.scheduler import Scheduler
|
from weboob.core.scheduler import Scheduler
|
||||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesPost, Thread, Message
|
from weboob.capabilities.messages import ICapMessages, ICapMessagesPost, Thread, Message
|
||||||
from weboob.tools.application.repl import ReplApplication
|
from weboob.tools.application.repl import ReplApplication
|
||||||
|
|
@ -203,9 +203,17 @@ class Monboob(ReplApplication):
|
||||||
self.weboob.loop()
|
self.weboob.loop()
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
for backend, message in self.weboob.do('iter_unread_messages'):
|
try:
|
||||||
self.send_email(backend, message)
|
for backend, message in self.weboob.do('iter_unread_messages'):
|
||||||
backend.set_message_read(message)
|
self.send_email(backend, message)
|
||||||
|
backend.set_message_read(message)
|
||||||
|
except CallErrors, e:
|
||||||
|
for backend, error, backtrace in e.errors:
|
||||||
|
print >>sys.stderr, u'Error(%s): %s' % (backend.name, error)
|
||||||
|
if logging.root.level == logging.DEBUG:
|
||||||
|
print >>sys.stderr, backtrace
|
||||||
|
if logging.root.level != logging.DEBUG:
|
||||||
|
print >>sys.stderr, 'Use --debug option to print backtraces.'
|
||||||
|
|
||||||
def send_email(self, backend, mail):
|
def send_email(self, backend, mail):
|
||||||
domain = self.config.get('domain')
|
domain = self.config.get('domain')
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import optparse
|
||||||
from optparse import OptionGroup, OptionParser
|
from optparse import OptionGroup, OptionParser
|
||||||
|
|
||||||
from weboob.capabilities.base import NotAvailable, NotLoaded
|
from weboob.capabilities.base import NotAvailable, NotLoaded
|
||||||
from weboob.core.ouiboube import Weboob
|
from weboob.core import Weboob, CallErrors
|
||||||
from weboob.tools.config.iconfig import ConfigError
|
from weboob.tools.config.iconfig import ConfigError
|
||||||
from weboob.tools.backend import ObjectNotAvailable
|
from weboob.tools.backend import ObjectNotAvailable
|
||||||
|
|
||||||
|
|
@ -318,5 +318,12 @@ class BaseApplication(object):
|
||||||
except ConfigError, e:
|
except ConfigError, e:
|
||||||
print 'Configuration error: %s' % e
|
print 'Configuration error: %s' % e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
except CallErrors, e:
|
||||||
|
for backend, error, backtrace in e.errors:
|
||||||
|
print >>sys.stderr, u'Error(%s): %s' % (backend.name, error)
|
||||||
|
if logging.root.level == logging.DEBUG:
|
||||||
|
print >>sys.stderr, backtrace
|
||||||
|
if logging.root.level != logging.DEBUG:
|
||||||
|
print >>sys.stderr, 'Use --debug option to print backtraces.'
|
||||||
finally:
|
finally:
|
||||||
app.deinit()
|
app.deinit()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue