Vue:expected The Promise rejection reason to being an Error

Source: Internet
Author: User

Add Eslint,new to the Vue project a Promise always displays error: expected the Promise rejection reason to be an error

Normally, the new one promise is written like this, and it doesn't feel like a problem.

      return New Promise ((resolve, reject) = {        if  (type) {          resolve (1)        Else  {          reject (0)        }      })

But the project adds ESLint you have to follow his rules.

If the direct reject (0) This is not possible, to change to this will remove this error message

Reject (new Error (0))

This essay is my study work record, if there is doubt welcome in the following comments, reproduced please indicate the source.

If you have help, please move the mouse to the bottom right to a praise, your support is my biggest motivation.

Vue:expected The Promise rejection reason to being an Error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.