Factorized error processing into QueryBase class, added more error checks