Make hGetContents throw an exception if an error is encountered