treat query error