Skip to content

Commit

Permalink
Fixed callback being called for errors thrown in the callback
Browse files Browse the repository at this point in the history
  • Loading branch information
rattletone committed Aug 3, 2019
1 parent 7c57c67 commit d99e4d5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/ApiRequest.js
Expand Up @@ -149,13 +149,14 @@ class ApiRequest {
});

if(callback) {
request
.then(data => {
request.then(
data => {
callback(null, data);
})
.catch(err => {
},
err => {
callback(err, null);
});
}
);
}
else {
return request;
Expand Down

0 comments on commit d99e4d5

Please sign in to comment.