properly handle errors from batch requests