LICENSE @ 78a1340b652d

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 ed67566c28f9
children (none)
Copyright (c) 2009 Steve Losh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.