Log details of one-off label printing error, when they occur

needed for troubleshooting
This commit is contained in:
Lance Edgar 2019-01-21 16:23:50 -06:00
parent 1d744d4c26
commit 5a96672d79

View file

@ -27,6 +27,7 @@ Product Views
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
import re import re
import logging
import six import six
import sqlalchemy as sa import sqlalchemy as sa
@ -52,6 +53,9 @@ from tailbone.progress import SessionProgress
from tailbone.util import raw_datetime from tailbone.util import raw_datetime
log = logging.getLogger(__name__)
# TODO: For a moment I thought this was going to be necessary, but now I think # TODO: For a moment I thought this was going to be necessary, but now I think
# not. Leaving it around for a bit just in case... # not. Leaving it around for a bit just in case...
@ -1169,6 +1173,7 @@ def print_labels(request):
try: try:
printer.print_labels([(product, quantity, {})]) printer.print_labels([(product, quantity, {})])
except Exception as error: except Exception as error:
log.warning("error occurred while printing labels", exc_info=True)
return {'error': six.text_type(error)} return {'error': six.text_type(error)}
return {} return {}