Method query finished and Exceptions class