HIVE-8610-trunk: fix error handling