Mini Program reported an error in Can't find variable: result;at api request fail callback

Mini Program found many such mistakes in the background

  • result is not defined; at App post function; at api request fail callback function
  • Can"t find variable: result ; at pages/home/home requestHomeData function; at api request fail callback function

there is neither any result, nor request in the corresponding method, not just this place, but I am sure that all result have made null judgments, and all fail callbacks do not use result,. I do not know why
the following is my encapsulated request

/**
   *  get  Promise
   * @param url
   * @param data
   * @param header
   * @returns {*|Promise<any>}
   */
  get: function (url, data = {}, header = {}) {
    if (this.globalData.deviceSerialNumber) {
      header = {...header, "device-serial-number": this.globalData.deviceSerialNumber};
    }
    return url && new Promise((resolve, reject) => {
      wx.request({
        url: url,
        method: "GET",
        data: data,
        header: {
          "content-type": "application/json", // 
          ...header
        },
        success: function (res) {
          resolve(res);
        },
        fail: function (res) {
          reject(res);
        }
      })
    });
  },
/**
   *  put  Promise
   * @param url
   * @param data
   * @param header
   * @returns {*|Promise<any>}
   */
  put: function (url, data = {}, header = {}) {
    if (this.globalData.deviceSerialNumber) {
      header = {...header, "device-serial-number": this.globalData.deviceSerialNumber};
    }
    return url && new Promise((resolve, reject) => {
      wx.request({
        url: url,
        method: "PUT",
        data: data,
        header: {
          "content-type": "application/json", // 
          ...header
        },
        success: function (res) {
          resolve(res);
        },
        fail: function (res) {
          reject(res);
        }
      })
    });
  }
Apr.16,2021

check whether the error callback you passed is caused by


. Have you solved the problem? I have also encountered the problem of


. Have you solved it on your side?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35165-2b2cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35165-2b2cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?