util: better error handling
Merge pull request #2 from cfstras/master

util: better error handling