Consolidate query errors into a constant and use it.