throw error directly from subqueries instead, and use the correct object to detect the null error message