lib/inquisitio/searcher.rb in inquisitio-0.1.1 vs lib/inquisitio/searcher.rb in inquisitio-0.1.2

- old
+ new

@@ -100,18 +100,22 @@ private def results if @results.nil? + Inquisitio.config.logger.info("Performing search: #{search_url}") response = Excon.get(search_url) raise InquisitioError.new("Search failed with status code: #{response.status} Message #{response.body}") unless response.status == 200 body = JSON.parse(response.body) @results = Results.new(body["hits"]["hit"], params[:page], params[:per], body["hits"]["found"]) end @results + rescue => e + Inquisitio.config.logger.error("Exception Performing search: #{search_url} #{e}") + raise InquisitioError.new("Exception performing search") end def search_url @search_url ||= begin return_fields = params[:returns].empty?? [:med_type, :med_id] : params[:returns]