Better error handling

See the commit log for more info.

**Important Note**: This PR should only be merged after https://github.com/hashdist/hashdist/pull/43 is in and after `python-hpcmp2` is updated to use this new version of hashdist.