Catch operational errors in more critical places.

This commit is contained in:
Roberto Rosario
2015-07-14 02:21:55 -04:00
parent 8d7a9df7e8
commit dbc08afd45
2 changed files with 21 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ from __future__ import unicode_literals
import datetime
import logging
from django.db import models, transaction
from django.db import OperationalError, models, transaction
from django.db.utils import IntegrityError
from django.utils.timezone import now
@@ -41,6 +41,8 @@ class LockManager(models.Manager):
else:
logger.debug('unable to acquire lock: %s', name)
raise LockError('Unable to acquire lock')
except OperationalError as exception:
raise LockError('Operational error while trying to acquire lock: %s; %s', name, exception)
else:
logger.debug('acquired lock: %s', name)
return lock