 
     args.unshift @sessionId if @sessionId
 
+    tries = @tries
     do helper = =>
       try
         result = @xmlrpc.methodCall method, args


# Note: All methods are synchronous (using fibers).
class $XAPI

  constructor: ({@host, @username, @password}) ->
    @connect()

        # Something went wrong.
        error = result.ErrorDescription or value
      catch error # Captures the error if it was thrown.

      # If it failed too much times, just stops.
      throw error unless --@tries

      # Gets the error code for transport errors and XAPI errors.
      code = error.code or error[0]
