BF: general Exception catch was excessive. Only IOError and OSError are possible and has different meanings

pull/134/head
Daniel Black 2013-03-10 15:29:27 +11:00
parent 6e77427516
commit c8c7b0b984
1 changed files with 6 additions and 1 deletions

View File

@ -477,10 +477,15 @@ class FileFilter(Filter):
# Try to open log file.
try:
container.open()
except Exception, e:
# see http://python.org/dev/peps/pep-3151/
except IOError, e:
logSys.error("Unable to open %s" % filename)
logSys.exception(e)
return False
except OSError, e: # pragma: no cover - requires race condition to tigger this
logSys.error("Error opening %s" % filename)
logSys.exception(e)
return False
while True:
line = container.readline()