Skip to content

Commit

Permalink
fix use of promises with requestretry module
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonahss committed Jul 1, 2016
1 parent 0b6d2a9 commit a0643c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"colors": "~1.1.2",
"lodash": "~4.0.0",
"q": "~1.4.1",
"requestretry": "~1.6.0",
"requestretry": "~1.9.0",
"sauce-tunnel": "~2.4.0",
"saucelabs": "~1.0.1"
},
Expand Down
15 changes: 7 additions & 8 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,17 @@ module.exports = function (grunt) {
* body.
*/
function makeRequest(params) {
var QPromiseFactory = function(resolver) {
return q.Promise(resolver);
};
params.retryStrategy = loggingRetryStrategy;
return q
.nfcall(request, params)
.then(function (result) {
var response = result[0];
var body = result[1];

params.promiseFactory = QPromiseFactory;
return request(params)
.then(function (response) {
if (response.statusCode !== 200) {
throw new Error('HTTP error (' + response.statusCode + ')');
}

return body;
return response.body;
})
.fail(function (error) {
throw new WrapperError([
Expand Down

0 comments on commit a0643c9

Please sign in to comment.