           .timeout MAX_WAITING_TIME
 
           .then (args) =>
+
             KiteLogger.started name, rpcMethod
+
             resolve (@transport?.tell args...
 
               .then (res) ->


              .catch (err) =>

                if err.name is 'KiteError' and \
                   err.message is 'token is expired'

                  return new Promise (resolve, reject) =>
                    @transport?.expireToken =>
                      resolve @transport.tell args...

                KiteLogger.failed name, rpcMethod, err
                throw err


      KiteLogger.failed name, rpcMethod
      Promise.reject @_kiteInvalidError


  handleKiteError: (err, args) ->

    return  unless err.name is 'KiteError'

    name = @getOption 'name'

    # In any case unset KiteCache if there is an authenticationError
    if err.type is 'authenticationError'
      KiteCache.unset name

    # If it was because token is expired try to recover it
    if err.message is 'token is expired'
      return new Promise (resolve, reject) =>
        @transport?.expireToken =>
          resolve @transport.tell args...

    # If not and the kite is kloud, make sure it's destroyed
    else if name is 'kloud'
      delete kd.singletons.kontrol.kites?.kloud?.singleton

    return null


  @createMethod = (ctx, { method, rpcMethod }) ->
