Skip to content

Commit

Permalink
Avoid uncaught promise error (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys authored Jul 4, 2017
1 parent bc0d99d commit 01b9fc4
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/fetch-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,8 @@ e.g. {"body": {"status: "registered"}}`);

FetchMock.prototype.respond = function (response, resolveHoldingPromise) {
response
.then(res => {
resolveHoldingPromise()
return res;
})
.catch(err => {
resolveHoldingPromise()
throw err;
})
.then(resolveHoldingPromise, resolveHoldingPromise)

return response;
}

Expand Down Expand Up @@ -390,4 +384,4 @@ FetchMock.prototype.sandbox = function (Promise) {
})


module.exports = FetchMock;
module.exports = FetchMock;

0 comments on commit 01b9fc4

Please sign in to comment.