Browse Source

[IMP] account_bank_statement_import_online: better logging

12.0
Alexey Pelykh 5 years ago
parent
commit
5c7a321ba2
  1. 12
      account_bank_statement_import_online/models/online_bank_statement_provider.py

12
account_bank_statement_import_online/models/online_bank_statement_provider.py

@ -5,6 +5,7 @@
from datetime import datetime from datetime import datetime
from dateutil.relativedelta import relativedelta, MO from dateutil.relativedelta import relativedelta, MO
from decimal import Decimal from decimal import Decimal
from html import escape
import logging import logging
from pytz import timezone, utc from pytz import timezone, utc
from sys import exc_info from sys import exc_info
@ -182,7 +183,6 @@ class OnlineBankStatementProvider(models.Model):
statement_date_until statement_date_until
) )
except: except:
e = exc_info()[1]
if is_scheduled: if is_scheduled:
_logger.warning( _logger.warning(
'Online Bank Statement Provider "%s" failed to' 'Online Bank Statement Provider "%s" failed to'
@ -195,16 +195,16 @@ class OnlineBankStatementProvider(models.Model):
) )
provider.message_post( provider.message_post(
body=_( body=_(
'Online Bank Statement Provider "%s" failed to'
' obtain statement data since %s until %s:\n%s'
'Failed to obtain statement data for period '
'since %s until %s: %s. See server logs for '
'more details.'
) % ( ) % (
provider.name,
statement_date_since, statement_date_since,
statement_date_until, statement_date_until,
str(e) if e else _('N/A'),
escape(str(exc_info()[1])) or _('N/A')
), ),
subject=_( subject=_(
'Online Bank Statement Provider failure'
'Issue with Online Bank Statement Provider'
), ),
) )
break break

Loading…
Cancel
Save