Add better error messages for failed queries.