Vue Request Error: Uncaught (in promise) [How to Solve]

This error will be reported if the reject error in the promise is not caught

getImage: function (url) {
        return new Promise((resolve, reject) => {
          wx.getImageInfo({
            src: url,
            success: function (res) {
              resolve(res)
            },
            fail: function () {
              reject("")
            }
          })
        }).catch((e) => {

console.log(e)
});
      },
getImage: function (url) {
        return new Promise((resolve, reject) => {
          wx.getImageInfo({
            src: url,
            success: function (res) {
              resolve(res)
            },
            fail: function () {
              reject("")
            }
          })
        }).catch((e) => {

console.log(e)
});
      },

As long as you add .catch((e) => {}) at the end, no error will be reported.

Similar Posts: