exeption catch on query