protect calls to log_internal_error against socket.error and OSError

This commit is contained in:
Frédéric Péters 2012-05-08 13:34:17 +02:00
parent d54f36b114
commit 10ee5d1eb6
2 changed files with 18 additions and 2 deletions

View File

@ -90,7 +90,15 @@ def cron(publisher):
None,
exc_type, exc_value,
tb)
publisher.logger.log_internal_error(error_summary, plain_error_msg)
try:
publisher.logger.log_internal_error(error_summary, plain_error_msg)
except socket.error:
# will happen if there is no mail server available and exceptions
# were configured to be mailed.
pass
except OSError:
# this could happen on file descriptor exhaustion
pass
time.sleep(10)

View File

@ -139,7 +139,15 @@ class HTTPResponse(quixote.http_response.HTTPResponse):
exc_type, exc_value,
tb)
get_publisher().logger.log_internal_error(error_summary, plain_error_msg)
try:
get_publisher().logger.log_internal_error(error_summary, plain_error_msg)
except socket.error:
# will happen if there is no mail server available and exceptions
# were configured to be mailed.
pass
except OSError:
# this could happen on file descriptor exhaustion
pass
job.exception = traceback.format_exc()
job.status = N_('failed')