What happens if you don't resolve or reject a promise?

前端 未结 5 2110
忘了有多久
忘了有多久 2020-12-04 15:24

I have a scenario where I am returning a promise. The promise is basically triggered by an ajax request.

On rejecting the promise it shows an error dialog that there

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 15:59

    It works and isn't really a problem, except when a caller of makeRequest expects of promise to fulfil. So, you're breaking the contract there.

    Instead, you could defer the promise, or (in this case) reject with status code/error.

提交回复
热议问题