More precise exception handling
In python2 OSError and IOError are different for no good reason, in python3 IOError is an alias for OSError.
This commit is contained in:
parent
10001a6b74
commit
8ab66245ff
@ -374,7 +374,7 @@ def main():
|
|||||||
hdlr = logging.FileHandler(os.path.join(log_dir,'tisbackup_%s.log' % (backup_start_date)))
|
hdlr = logging.FileHandler(os.path.join(log_dir,'tisbackup_%s.log' % (backup_start_date)))
|
||||||
hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
|
hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
|
||||||
logger.addHandler(hdlr)
|
logger.addHandler(hdlr)
|
||||||
except Exception, e:
|
except IOError, e:
|
||||||
if action == 'cleanup' and e.errno == errno.ENOSPC:
|
if action == 'cleanup' and e.errno == errno.ENOSPC:
|
||||||
logger.warning("No space left on device, disabling file logging.")
|
logger.warning("No space left on device, disabling file logging.")
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user