                 @hide_suggestion()
             return @
 
-        # Callback used by the cursor
+        # Callback used by the cursor when the user hit 'more results'
         callback_query: (data) =>
             # If we get a run time error
-            if data instanceof rethinkdb.errors.RuntimeError
+            if data instanceof rethinkdb.errors.RuntimeError or data instanceof rethinkdb.errors.BadQuery or data instanceof rethinkdb.errors.ClientError or data instanceof rethinkdb.errors.ClientError
                 @.$('.loading_query_img').css 'display', 'none'
                 @.results_view.render_error(@query, data)
                 return false

                    @current_results.push data
                return false

        # Callback for multiple queries
        callback_multiple_query: (data) =>
            # If we get a run time error
            if data instanceof rethinkdb.errors.RuntimeError
                @.$('.loading_query_img').css 'display', 'none'
                @.results_view.render_error(@query, data)
                return false

            @current_query_index++
            if @current_query_index is @queries.length-1
                if @cursor?
                    @cursor.close()
                @cursor = eval(@queries[@current_query_index])
                @cursor.next(@callback_query)
            else
                if @cursor?
                    @cursor.close()
                @cursor = eval(@queries[@current_query_index])
                @cursor.next(@callback_multiple_query)

            return false
           

        # Function triggered when the user click on 'more results'
        show_more_results: (event) =>
            try

                window.conn.close()
            catch err
                #console.log 'Could not destroy connection'
            @cursor.close()
            clearTimeout @timeout
    
    class @InputQuery extends Backbone.View
