Added query when throwing DatabaseQuery exceptions