             try
                 r.connect @server, (err, connection) ->
                     if err?
-                        that.on_fail()
+                        that.on_fail(err)
                     else
                         that.connection = connection
                         that.on_success(connection)

            @driver_connected = 'connected'

        # Called if the driver could not connect
        error_on_connect: =>
            @results_view.cursor_timed_out()
            # We fail to connect, so we display a message except if we were already disconnected and we are not trying to manually reconnect
            # So if the user fails to reconnect after a failure, the alert will still flash
            @.$('#user-alert-space').hide()
            @.$('#user-alert-space').html @alert_connection_fail_template({})
            @.$('#user-alert-space').slideDown 'fast'
            @reconnecting = false
            @driver_connected = 'error'

        # Reconnect, function triggered if the user click on reconnect
        reconnect: (event) =>

                unless @dont_timeout_connection
                    @timeout = setTimeout @connect, 5*60*1000
            catch err
                @on_fail(err)
    
        postpone_reconnection: =>
            clearTimeout @timeout
