Intercept common IO errors exceptions.
When the task directory doesn't exist or when a file can't be read or written,
t.py fails with a full stacktrace exception. This change allows t.py to fail
more gracefully, printing the exception message, the relevant file, and then
exiting with an errorlevel code of 1.
# Non existant directory issue
/home/dereckson/dev/t ] ./t.py -t /nonexistent Lorem ipsum dolor
No such file or directory - /nonexistent/tasks
# File permission issue
/home/dereckson/dev/t ] mkdir test
/home/dereckson/dev/t ] ./t.py -t test Lorem ipsum dolor
/home/dereckson/dev/t ] chmod 000 test/.tasks.done
/home/dereckson/dev/t ] ./t.py -t test Lorem ipsum dolor
Permission denied - test/.tasks.done
author |
Dereckson |
date |
Sat, 31 Aug 2013 10:31:43 +0200 |
parents |
0c75cfe0a6a4 |
children |
(none) |
Add some documentation. | id:099d5d22044eee4858835037431e409ba67c6db4
Add a license. | id:931f182337038062f181f122c48ffc870a028767
Add a quiet mode. | id:b1d61f718eec29cba4ee55b56a067a79959c5d42
Add creation date to metadata. | id:e9866e56460791b864fe3db0c6cd0610ba436f77
Add ordering. | id:f3a326db186e503793182027f1663098c86d5d5f